-
Notifications
You must be signed in to change notification settings - Fork 267
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
Feat: Max requests flag to exit after N requests #405
Conversation
# Count completed requests and check against Max | ||
self.server._complete_requests_counted += 1 | ||
if self.server._complete_requests_counted > self.server.max_requests: | ||
logger.info('Max requests completed. Shutting down daphne...') | ||
os.system("ps aux | grep 'daphne'") | ||
bash_command = "kill $(ps aux | grep 'daphne' | awk '{print $2}')" | ||
os.system(bash_command) | ||
sys.exit(0) | ||
|
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.
Hmmm. OK, so... the expectation would be that we restart after X requests, not just shut down right?
I'm going to close this as per my comment on the issue:
|
This is my first Open Source PR, but here is the
--max-requests
setting to periodically restart workers.There are no tests, I'm happy to add them if this feature interests the Daphne maintainers.
Please let me know your thoughts!
Refs #403