Skip to content

Commit

Permalink
fix: 🐛 exit job correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Ruck committed Oct 22, 2023
1 parent 3d2c7c7 commit 702dd66
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions services/cron-jobs/push-send-queued/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const start = async () => {
await start().catch((e) => {
throw e;
});
})().finally(async () => {
await mongoDisconnect();
process.exit(0);
})().finally(() => {
mongoDisconnect();
});
5 changes: 2 additions & 3 deletions services/cron-jobs/sync-deputy-profiles/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ const start = async () => {
await mongoConnect();
console.log('procedures', await DeputyModel.countDocuments({}));
await start();
})().finally(async () => {
await mongoDisconnect();
})().catch(async (e) => {
await mongoDisconnect();
throw e;
process.exit(0);
});
1 change: 1 addition & 0 deletions services/cron-jobs/sync-deputy-profiles/src/mongoose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ export const mongoDisconnect = () => {
if (connection) {
return connection.disconnect();
}
return;
};

0 comments on commit 702dd66

Please sign in to comment.