MCPcopy Create free account
hub / github.com/DingyangLyu/MatClaw / enqueueMessageCheck

Method enqueueMessageCheck

src/group-queue.ts:70–96  ·  view source on GitHub ↗
(groupJid: string)

Source from the content-addressed store, hash-verified

68 }
69
70 enqueueMessageCheck(groupJid: string): void {
71 if (this.shuttingDown) return;
72
73 const state = this.getGroup(groupJid);
74
75 if (state.active) {
76 state.pendingMessages = true;
77 logger.debug({ groupJid }, 'Container active, message queued');
78 return;
79 }
80
81 if (this.activeCount >= MAX_CONCURRENT_CONTAINERS) {
82 state.pendingMessages = true;
83 if (!this.waitingGroups.includes(groupJid)) {
84 this.waitingGroups.push(groupJid);
85 }
86 logger.debug(
87 { groupJid, activeCount: this.activeCount },
88 'At concurrency limit, message queued',
89 );
90 return;
91 }
92
93 this.runForGroup(groupJid, 'messages').catch((err) =>
94 logger.error({ groupJid, err }, 'Unhandled error in runForGroup'),
95 );
96 }
97
98 enqueueTask(groupJid: string, taskId: string, fn: () => Promise<void>): void {
99 if (this.shuttingDown) return;

Callers 4

scheduleRetryMethod · 0.95
startMessageLoopFunction · 0.80
recoverPendingMessagesFunction · 0.80

Calls 3

getGroupMethod · 0.95
runForGroupMethod · 0.95
pushMethod · 0.80

Tested by

no test coverage detected