mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
Reply: share queued message dedupe state
This commit is contained in:
@@ -4,10 +4,17 @@ import { kickFollowupDrainIfIdle } from "./drain.js";
|
|||||||
import { getExistingFollowupQueue, getFollowupQueue } from "./state.js";
|
import { getExistingFollowupQueue, getFollowupQueue } from "./state.js";
|
||||||
import type { FollowupRun, QueueDedupeMode, QueueSettings } from "./types.js";
|
import type { FollowupRun, QueueDedupeMode, QueueSettings } from "./types.js";
|
||||||
|
|
||||||
const RECENT_QUEUE_MESSAGE_IDS = createDedupeCache({
|
/**
|
||||||
|
* Keep queued message-id dedupe shared across bundled chunks so redeliveries
|
||||||
|
* are rejected no matter which chunk receives the enqueue call.
|
||||||
|
*/
|
||||||
|
const _g = globalThis as typeof globalThis & {
|
||||||
|
__openclaw_recent_queue_message_ids__?: ReturnType<typeof createDedupeCache>;
|
||||||
|
};
|
||||||
|
const RECENT_QUEUE_MESSAGE_IDS = (_g.__openclaw_recent_queue_message_ids__ ??= createDedupeCache({
|
||||||
ttlMs: 5 * 60 * 1000,
|
ttlMs: 5 * 60 * 1000,
|
||||||
maxSize: 10_000,
|
maxSize: 10_000,
|
||||||
});
|
}));
|
||||||
|
|
||||||
function buildRecentMessageIdKey(run: FollowupRun, queueKey: string): string | undefined {
|
function buildRecentMessageIdKey(run: FollowupRun, queueKey: string): string | undefined {
|
||||||
const messageId = run.messageId?.trim();
|
const messageId = run.messageId?.trim();
|
||||||
|
|||||||
Reference in New Issue
Block a user