perf(gateway): skip idle channel shutdown work

This commit is contained in:
Peter Steinberger
2026-02-13 23:56:55 +00:00
parent a0cbf9002d
commit 3a73e2508b

View File

@@ -180,8 +180,12 @@ export function createChannelManager(opts: ChannelManagerOptions): ChannelManage
const stopChannel = async (channelId: ChannelId, accountId?: string) => {
const plugin = getChannelPlugin(channelId);
const cfg = loadConfig();
const store = getStore(channelId);
// Fast path: nothing running and no explicit plugin shutdown hook to run.
if (!plugin?.gateway?.stopAccount && store.aborts.size === 0 && store.tasks.size === 0) {
return;
}
const cfg = loadConfig();
const knownIds = new Set<string>([
...store.aborts.keys(),
...store.tasks.keys(),