-
-
Notifications
You must be signed in to change notification settings - Fork 746
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
Deregister services from service registry on shutdown #5396
Deregister services from service registry on shutdown #5396
Conversation
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.
@khushboobhatia01 Good start.
- Is it possible to write a unit test for deregister_service?
- How about other services (i.e. api, rulesengine, etc.)? Search service_registry=True to find them.
Addressed @m4dcoder |
…ister_on_shutdown
…st2 into deregister_on_shutdown
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.
Minor concern on error handling during deregistration.
try: | ||
service_setup.deregister_service(service) | ||
except: | ||
assert False, "service_setup.deregister_service raised exception" |
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.
@khushboobhatia01 What happens if this error is raised on shutdown? I think it is ok to make this silent if there is nothing to be deregister.
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.
@m4dcoder We don't expect deregister() to raise an exception when service_registry is disabled or there's nothing to deregister. This test case would fail only when some unintended change is causing deregister to fail. All edge cases are handled in deregister(). Therefore it might be good to know if some new change is causing it to fail.
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.
LGTM. Thanks for your contribution and patience.
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.
@khushboobhatia01 Could you please also add Changelog for this PR before we merge it?
…ister_on_shutdown
Done @armab. Thanks for reminding :) |
Great stuff! Thanks @khushboobhatia01 for the work and @m4dcoder for review! 👍 |
Few services like worker, workflow engine, scheduler and notifier perform a shutdown sequence before exiting the process. This PR will ensure that the services deregister themselves from service registry on shutdown and then continue with shutdown sequence.
(PR based on #5373 step 1)