-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
refactor(root): introducing graceful shutdown and optimise docker images #6754
base: next
Are you sure you want to change the base?
Conversation
Add a new module called "graceful-shutdown" to the "application-generic" library. This module includes a "ShutdownService" class that provides a timeout value for graceful shutdown. The timeout value is retrieved from the environment variable "GRACEFUL_SHUTDOWN_TIMEOUT" with a default value of 5000. This module also exports the "ShutdownService" for external use.
…s in nest.controller.ts
✅ Deploy Preview for novu-stg-vite-dashboard-poc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
libs/application-generic/src/graceful-shutdown/shutdown.service.ts
Outdated
Show resolved
Hide resolved
@@ -211,7 +211,6 @@ | |||
"devDependencies": { | |||
"@apidevtools/json-schema-ref-parser": "11.6.4", | |||
"@arethetypeswrong/cli": "^0.16.4", | |||
"@nestjs/common": "10.4.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚠ issue: We need to keep this so that the test suites have the needed types. Please revert the removal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @rifont, If I am adding this into dev dependency and then running --prod
its not getting installed and API build up is failing. any workaround/idea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's strange, as @novu/api
declares @nestjs/common
as a dependency
here which means it should be installed when using the --prod
flag.
Could you please share the error log for further debugging?
I believe reverting the removal of this dependency is a blocker for Framework tests to pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @rifont, Please find error below:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now solved. See 4a3e98d.
The trick is that @novu/framework requires a range for @nestjs/common peer dependency but by pinning the @nestjs/common version via PNPM overrides we effectively teach PNPM to add the correct dependencies when installing only production dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested locally as well. It worked fabulous for me. Sok, we need an article for all of this 😄 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will! 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍
…dation This commit adds validation for the GRACEFUL_SHUTDOWN_TIMEOUT environment variable in multiple config files. The variable is now validated as a number with a default value of 5000. This ensures that the application gracefully shuts down within the specified timeout period. Refs: #issue-number
The @nestjs/common global override set to "@nestjs/common@>=10.0.0 <11.0.0": "10.4.1" is necessary to teach the API application to inject it properly to @novu/framework as a peer dependency. Refer to #6754 (comment)
What changed? Why was the change needed?
This PR linked to below issues
Screenshots
New Images are now 46% Slimmer