mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 00:41:25 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -82,7 +82,9 @@ function getAnnounceQueue(
|
||||
|
||||
function scheduleAnnounceDrain(key: string) {
|
||||
const queue = ANNOUNCE_QUEUES.get(key);
|
||||
if (!queue || queue.draining) return;
|
||||
if (!queue || queue.draining) {
|
||||
return;
|
||||
}
|
||||
queue.draining = true;
|
||||
void (async () => {
|
||||
try {
|
||||
@@ -92,19 +94,27 @@ function scheduleAnnounceDrain(key: string) {
|
||||
if (queue.mode === "collect") {
|
||||
if (forceIndividualCollect) {
|
||||
const next = queue.items.shift();
|
||||
if (!next) break;
|
||||
if (!next) {
|
||||
break;
|
||||
}
|
||||
await queue.send(next);
|
||||
continue;
|
||||
}
|
||||
const isCrossChannel = hasCrossChannelItems(queue.items, (item) => {
|
||||
if (!item.origin) return {};
|
||||
if (!item.originKey) return { cross: true };
|
||||
if (!item.origin) {
|
||||
return {};
|
||||
}
|
||||
if (!item.originKey) {
|
||||
return { cross: true };
|
||||
}
|
||||
return { key: item.originKey };
|
||||
});
|
||||
if (isCrossChannel) {
|
||||
forceIndividualCollect = true;
|
||||
const next = queue.items.shift();
|
||||
if (!next) break;
|
||||
if (!next) {
|
||||
break;
|
||||
}
|
||||
await queue.send(next);
|
||||
continue;
|
||||
}
|
||||
@@ -117,7 +127,9 @@ function scheduleAnnounceDrain(key: string) {
|
||||
renderItem: (item, idx) => `---\nQueued #${idx + 1}\n${item.prompt}`.trim(),
|
||||
});
|
||||
const last = items.at(-1);
|
||||
if (!last) break;
|
||||
if (!last) {
|
||||
break;
|
||||
}
|
||||
await queue.send({ ...last, prompt });
|
||||
continue;
|
||||
}
|
||||
@@ -125,13 +137,17 @@ function scheduleAnnounceDrain(key: string) {
|
||||
const summaryPrompt = buildQueueSummaryPrompt({ state: queue, noun: "announce" });
|
||||
if (summaryPrompt) {
|
||||
const next = queue.items.shift();
|
||||
if (!next) break;
|
||||
if (!next) {
|
||||
break;
|
||||
}
|
||||
await queue.send({ ...next, prompt: summaryPrompt });
|
||||
continue;
|
||||
}
|
||||
|
||||
const next = queue.items.shift();
|
||||
if (!next) break;
|
||||
if (!next) {
|
||||
break;
|
||||
}
|
||||
await queue.send(next);
|
||||
}
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user