mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-18 14:57:27 +00:00
refactor(queue): share next-item drain helper across queue drains
This commit is contained in:
@@ -129,6 +129,19 @@ export function waitForQueueDebounce(queue: {
|
||||
});
|
||||
}
|
||||
|
||||
export async function drainNextQueueItem<T>(
|
||||
items: T[],
|
||||
run: (item: T) => Promise<void>,
|
||||
): Promise<boolean> {
|
||||
const next = items[0];
|
||||
if (!next) {
|
||||
return false;
|
||||
}
|
||||
await run(next);
|
||||
items.shift();
|
||||
return true;
|
||||
}
|
||||
|
||||
export function buildQueueSummaryPrompt(params: {
|
||||
state: QueueSummaryState;
|
||||
noun: string;
|
||||
|
||||
Reference in New Issue
Block a user