Skip to content

Commit ff78b31

Browse files
committed
unregister the correct handler and add early detection
1 parent aa3e57d commit ff78b31

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

packages/core/src/v3/serverOnly/shutdownManager.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ class ShutdownManager {
3333
}
3434

3535
unregister(name: string) {
36+
if (!this.handlers.has(name)) {
37+
throw new Error(`Shutdown handler "${name}" not registered`);
38+
}
39+
3640
this.handlers.delete(name);
3741
}
3842

packages/redis-worker/src/worker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ class Worker<TCatalog extends WorkerCatalog> {
541541
}
542542

543543
public async stop() {
544-
shutdownManager.unregister("redis-worker");
544+
shutdownManager.unregister(`redis-worker:${this.options.name}`);
545545
await this.shutdown();
546546
}
547547
}

0 commit comments

Comments
 (0)