Skip to content

Commit

Permalink
fix: force closing command when openhandles are open
Browse files Browse the repository at this point in the history
  • Loading branch information
moroine committed Dec 14, 2023
1 parent 8399acf commit c78dc87
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions server/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { closeMongoConnection } from "@/common/mongodb"
import { closeElasticSearch } from "./common/esClient"
import { logger } from "./common/logger"
import { sleep } from "./common/utils/asyncUtils"
import { notifyToSlack } from "./common/utils/slackUtils"
import config from "./config"
import { closeSentry, initSentryProcessor } from "./http/sentry"
import server from "./http/server"
Expand Down Expand Up @@ -71,6 +72,12 @@ program
.hook("postAction", async () => {
await Promise.all([closeMongoConnection(), closeElasticSearch()])
await closeSentry()

setTimeout(async () => {
await notifyToSlack({ error: true, subject: "Process not released", message: "Review open handles using wtfnode" })
// eslint-disable-next-line n/no-process-exit
process.exit(1)
}, 10_000).unref()
})

program
Expand Down

0 comments on commit c78dc87

Please sign in to comment.