fix: address review feedback for per-group queue reliability
- Fix startup recovery running before WhatsApp connects, which could permanently lose agent responses by advancing lastAgentTimestamp before sock is initialized - Add 5s retry on container failure so messages aren't silently dropped until a new message arrives for the group - Use `container stop` in shutdown instead of raw SIGTERM to CLI wrapper, ensuring proper container cleanup - Replace unnecessary dynamic imports with static imports in processTaskIpc - Guard JSON.parse of DB-stored last_agent_timestamp against corruption - Validate MAX_CONCURRENT_CONTAINERS (default 5, min 1, NaN-safe) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -26,7 +26,7 @@ export interface SchedulerDependencies {
|
||||
registeredGroups: () => Record<string, RegisteredGroup>;
|
||||
getSessions: () => Record<string, string>;
|
||||
queue: GroupQueue;
|
||||
onProcess: (groupJid: string, proc: ChildProcess) => void;
|
||||
onProcess: (groupJid: string, proc: ChildProcess, containerName: string) => void;
|
||||
}
|
||||
|
||||
async function runTask(
|
||||
@@ -98,7 +98,7 @@ async function runTask(
|
||||
chatJid: task.chat_jid,
|
||||
isMain,
|
||||
},
|
||||
(proc) => deps.onProcess(task.chat_jid, proc),
|
||||
(proc, containerName) => deps.onProcess(task.chat_jid, proc, containerName),
|
||||
);
|
||||
|
||||
if (output.status === 'error') {
|
||||
|
||||
Reference in New Issue
Block a user