Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(rooms): wake channel sends when a stale speaker is dropped

erywima5e917ba1891
diff --git a/server/index.ts b/server/index.ts
index 84139e50b1..6f3f32cfc9 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -7022,7 +7022,7 @@ function drainQueuedSends() {
}
}
function drainQueuedSendsNow() {
- roomSpeakers.forgetStale();
+ if (roomSpeakers.forgetStale() > 0) drainQueuedChannelSends(); // a freed room may also hold channel messages
automationReports.flush();
drainSteeredMessages(store, (botId, threadId, prompt, userMessage, excludeIds, unattended, head) =>
new Promise<void>((resolve, reject) => {
@@ -15013,7 +15013,7 @@ const pruneDecisionLog = () => {
};
pruneDecisionLog();
setInterval(pruneDecisionLog, 6 * 60 * 60_000).unref();
-setInterval(() => { if (roomSpeakers.forgetStale() > 0) drainQueuedSends(); }, 15_000).unref();
+setInterval(() => { if (roomSpeakers.forgetStale() > 0) { drainQueuedSends(); drainQueuedChannelSends(); } }, 15_000).unref();
workspaceAccess = createWorkspaceAccess({ sessions, cookieName: SESSION_COOKIE, closeSessionStreams });
// With the bridge's five-second deadline, this bounds stale portal access on quiet streams to fifteen seconds.
const workspaceAccessTimer = workspaceAccess ? setInterval(() => {