-
Notifications
You must be signed in to change notification settings - Fork 57
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
api: polish api service shutdown and top-level context handling #237
api: polish api service shutdown and top-level context handling #237
Conversation
…fecycle-in-api-server-e2b-1392
…fecycle-in-api-server-e2b-1392
Hey @tychoish, I saw you started adding some changes in orchestrator and template-manager. Are those relevant to API part? Ideally we would have several smaller PRs rather than one PR. |
@jakubno definitely can split it up: the change to the API wanted a changed to a shared package. There's no way to change the shared code and the calling code (in the API and orchestrator packages,) in different commits, but I can pull the shared change from the larger API changes. Regardless the orchestrator change is pretty small. |
…fecycle-in-api-server-e2b-1392
No problem with that, just making sure it has limited scope |
…469' into manage-http-server-lifecycle-in-api-server-e2b-1392
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.
Status:
|
Update: I've thoroughly tested this and am confident that it's safe to merge and deploy. |
Based on:
It seems like we should make this handle
|
This makes shutdown, in response to SIGTERM, cleaner and more correct:
As an added bonus, I made some changes to error handling and logging which should remove the case of "process exited without logging anything useful".
There are still some aspects which could require more attention in a follow up PR:
main()
, but this requires more churn and should happen in a later PR.The changes for shutdown handling are pretty generic (though not implemented here. If needed later, we can either use stuff from one of my repos (if suitable) or factor the generic parts out to be used in other processes.
✨
Description by Callstackai
This PR improves the API service shutdown handling and top-level context management. It ensures that the shutdown process is cleaner and more correct, avoiding unnecessary context creation and ensuring all request handlers complete before exiting. Additionally, it enhances error handling and logging.
Diagrams of code changes
Files Changed
This PR includes files in programming languages that we currently do not support. We have not reviewed files with the extensions
.go
. See list of supported languages.