Skip to content

Commit

Permalink
feat(sidetrack): support SIGTERM by letting existing jobs run but tur…
Browse files Browse the repository at this point in the history
…ning off polling
  • Loading branch information
aniravi24 committed Feb 13, 2025
1 parent 8c523e8 commit 7fb2b2d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/sidetrack/src/effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@ export function makeLayer<Queues extends SidetrackQueuesGenericType>(
return Effect.dieMessage(
"No connection string provided, cannot run sidetrack migrations",
);

// Handle SIGTERM by stopping polling but allowing running jobs to complete
// eslint-disable-next-line @typescript-eslint/no-misused-promises
process.on("SIGTERM", () => Effect.runPromise(stop()));

return Effect.promise(() =>
runMigrations(databaseOptions.connectionString),
).pipe(
Expand Down

0 comments on commit 7fb2b2d

Please sign in to comment.