fix(core): Fix removal of triggers and pollers from memory on deactivation in multi-main setup (#8416)

This commit is contained in:
Iván Ovejero 2024-01-23 12:34:40 +01:00 committed by GitHub
parent a0a1830696
commit 2257ec63b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -209,8 +209,13 @@ export class ActiveWorkflows {
const w = this.activeWorkflows[workflowId];
w.triggerResponses?.forEach(async (r) => await this.close(r, workflowId, 'trigger'));
w.pollResponses?.forEach(async (r) => await this.close(r, workflowId, 'poller'));
for (const r of w.triggerResponses ?? []) {
await this.close(r, workflowId, 'trigger');
}
for (const r of w.pollResponses ?? []) {
await this.close(r, workflowId, 'poller');
}
delete this.activeWorkflows[workflowId];
@ -219,10 +224,7 @@ export class ActiveWorkflows {
async removeAllTriggerAndPollerBasedWorkflows() {
for (const workflowId of Object.keys(this.activeWorkflows)) {
const w = this.activeWorkflows[workflowId];
w.triggerResponses?.forEach(async (r) => await this.close(r, workflowId, 'trigger'));
w.pollResponses?.forEach(async (r) => await this.close(r, workflowId, 'poller'));
await this.remove(workflowId);
}
}