Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Gruenfelder committed Jun 18, 2024
1 parent b7c383e commit 6754e2d
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/shared/eventScheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ class EventScheduler {
subType,
delaySeconds: (date.getTime() - Date.now()) / 1000,
});
this.#eventsByTenants[tenantId] ??= {};
const timeoutId = setTimeout(() => {
delete this.#eventsByTenants[tenantId][timeoutId];
setTimeout(() => {
delete this.#scheduledEvents[key];
redisPub.broadcastEvent(tenantId, { type, subType }).catch((err) => {
cds.log(COMPONENT_NAME).error("could not execute scheduled event", err, {
Expand All @@ -40,12 +38,9 @@ class EventScheduler {
});
});
}, relative).unref();
this.#eventsByTenants[tenantId][timeoutId] = true;
}

clearForTenant(tenantId) {
Object.values(this.#eventsByTenants[tenantId]).forEach((timeoutId) => clearTimeout(timeoutId));
}
clearForTenant() {}

calculateOffset(type, subType, startAfter) {
const eventConfig = config.getEventConfig(type, subType);
Expand Down

0 comments on commit 6754e2d

Please sign in to comment.