mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 02:18:25 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -14,7 +14,9 @@ export function scheduleFollowupDrain(
|
||||
runFollowup: (run: FollowupRun) => Promise<void>,
|
||||
): void {
|
||||
const queue = FOLLOWUP_QUEUES.get(key);
|
||||
if (!queue || queue.draining) return;
|
||||
if (!queue || queue.draining) {
|
||||
return;
|
||||
}
|
||||
queue.draining = true;
|
||||
void (async () => {
|
||||
try {
|
||||
@@ -28,7 +30,9 @@ export function scheduleFollowupDrain(
|
||||
// Debug: `pnpm test src/auto-reply/reply/queue.collect-routing.test.ts`
|
||||
if (forceIndividualCollect) {
|
||||
const next = queue.items.shift();
|
||||
if (!next) break;
|
||||
if (!next) {
|
||||
break;
|
||||
}
|
||||
await runFollowup(next);
|
||||
continue;
|
||||
}
|
||||
@@ -55,7 +59,9 @@ export function scheduleFollowupDrain(
|
||||
if (isCrossChannel) {
|
||||
forceIndividualCollect = true;
|
||||
const next = queue.items.shift();
|
||||
if (!next) break;
|
||||
if (!next) {
|
||||
break;
|
||||
}
|
||||
await runFollowup(next);
|
||||
continue;
|
||||
}
|
||||
@@ -63,7 +69,9 @@ export function scheduleFollowupDrain(
|
||||
const items = queue.items.splice(0, queue.items.length);
|
||||
const summary = buildQueueSummaryPrompt({ state: queue, noun: "message" });
|
||||
const run = items.at(-1)?.run ?? queue.lastRun;
|
||||
if (!run) break;
|
||||
if (!run) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Preserve originating channel from items when collecting same-channel.
|
||||
const originatingChannel = items.find((i) => i.originatingChannel)?.originatingChannel;
|
||||
@@ -96,7 +104,9 @@ export function scheduleFollowupDrain(
|
||||
const summaryPrompt = buildQueueSummaryPrompt({ state: queue, noun: "message" });
|
||||
if (summaryPrompt) {
|
||||
const run = queue.lastRun;
|
||||
if (!run) break;
|
||||
if (!run) {
|
||||
break;
|
||||
}
|
||||
await runFollowup({
|
||||
prompt: summaryPrompt,
|
||||
run,
|
||||
@@ -106,7 +116,9 @@ export function scheduleFollowupDrain(
|
||||
}
|
||||
|
||||
const next = queue.items.shift();
|
||||
if (!next) break;
|
||||
if (!next) {
|
||||
break;
|
||||
}
|
||||
await runFollowup(next);
|
||||
}
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user