8000 feat: implement graceful shutdown on sigterm by sweatybridge · Pull Request #728 · supabase/postgres-meta · GitHub
[go: up one dir, main page]

Skip to content

feat: implement graceful shutdown on sigterm #728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
chore: address pr comments
  • Loading branch information
sweatybridge committed Feb 21, 2024
commit cdb97d42cf54de5cc9bb54a65768b805960b2b11
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ COPY --from=build /usr/src/app/node_modules node_modules
COPY --from=build /usr/src/app/dist dist
COPY package.json ./
ENV PG_META_PORT=8080
# `npm run start` does not forward signals to child process
CMD ["node", "dist/server/server.js"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was wrong with npm start (run can be omitted here)?
It's one more place you've to remember to update dist/server/server.js in case it's moved 👀

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm run start wasn't passing down signals from the parent process. I tried it initially with a barebone docker-compose.yml.

version: '3'

services:
  pgmeta:
    build: .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be related to this issue npm/cli#6684

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🫠

EXPOSE 8080
# --start-period defaults to 0s, but can't be set to 0s (to be explicit) by now
Expand Down
4 changes: 2 additions & 2 deletions src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ if (EXPORT_DOCS) {
})
)
} else {
const closeListeners = closeWithGrace(async ({ signal, err, manual }) => {
const closeListeners = closeWithGrace(async ({ err }) => {
if (err) {
app.log.error(err)
}
await app.close()
})
app.addHook('onClose', async (instance) => {
app.addHook('onClose', async () => {
closeListeners.uninstall()
})

Expand Down
0