mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-27 21:33:41 +02:00
fix(gateway): remove cleanupPendingRequests that rejects all concurrent users
cleanupPendingRequests() iterated the service-wide pendingRequests Map and rejected every entry. Since it was called from connectUser's catch block (a per-user error path), one user's connection failure would spuriously reject other users' in-flight verify RPCs. The call was also redundant: sendVerifyRpc already cleans up its own entry in all failure paths (timeout, RPC error, route failure). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -859,7 +859,6 @@ export class TelegramService implements OnModuleInit, OnModuleDestroy {
|
||||
} catch (error) {
|
||||
// Cleanup virtual device on failure
|
||||
this.eventsGateway.unregisterVirtualDevice(deviceId);
|
||||
this.cleanupPendingRequests();
|
||||
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
if (message.includes("REJECTED")) {
|
||||
@@ -1072,14 +1071,4 @@ export class TelegramService implements OnModuleInit, OnModuleDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
// ── Cleanup ──
|
||||
|
||||
/** Cleanup all pending requests (used on verify failure) */
|
||||
private cleanupPendingRequests(): void {
|
||||
for (const [id, pending] of this.pendingRequests) {
|
||||
clearTimeout(pending.timer);
|
||||
pending.reject(new Error("Cleaned up"));
|
||||
this.pendingRequests.delete(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user