This repository was archived by the owner on Sep 18, 2023. It is now read-only.
Open
Conversation
klahnakoski
commented
Aug 6, 2020
Comment on lines
-116
to
+130
| start = time.time() | ||
| while time.time() - start < 30: | ||
| if login.last_state_check is None: | ||
| pass | ||
| elif (time.time() - login.last_state_check > | ||
| login.max_sleep_no_state_check): | ||
| logger.error( | ||
| "No response from web interface for {} seconds, shutting " | ||
| "down.".format(login.max_sleep_no_state_check)) | ||
| exit_sigint() | ||
| time.sleep(0.5) | ||
| # start = time.time() | ||
| # while time.time() - start < 30: | ||
| # if login.last_state_check is None: | ||
| # pass | ||
| # elif (time.time() - login.last_state_check > | ||
| # login.max_sleep_no_state_check): | ||
| # logger.error( | ||
| # "No response from web interface for {} seconds, shutting " | ||
| # "down.".format(login.max_sleep_no_state_check)) | ||
| # exit_sigint() | ||
| # time.sleep(0.5) |
Author
There was a problem hiding this comment.
I will require guidance here: This 2 second response time is too strict on my machine.
Author
There was a problem hiding this comment.
...plus it seems to delay response for 30 seconds
mozilla_aws_cli/listener.py
Outdated
Comment on lines
232
to
248
| class ServerThread(threading.Thread): | ||
|
|
||
| def __init__(self, app): | ||
| threading.Thread.__init__(self) | ||
| self.srv = make_server('127.0.0.1', port, app) | ||
| self.ctx = app.app_context() | ||
| self.ctx.push() | ||
|
|
||
| def run(self): | ||
| self.srv.serve_forever() | ||
| logger.debug("Flask done") | ||
|
|
||
| def shutdown(self): | ||
| try: | ||
| self.srv.shutdown() | ||
| except Exception: | ||
| ... |
Author
There was a problem hiding this comment.
We make a server so we have shutdown control
Comment on lines
+224
to
+225
| is_done.set() | ||
| threading.Timer(2, server.shutdown).start() |
Author
There was a problem hiding this comment.
Call shutdown in a couple of seconds. This could be shorter time, if we know more about how long the shutdown response takes to be delivered.
|
|
||
| server = ServerThread(app) | ||
| server.start() | ||
| is_done.wait() |
Author
There was a problem hiding this comment.
login() will actually return
klahnakoski
added a commit
to klahnakoski/mozilla-aws-cli-mozilla
that referenced
this pull request
Aug 11, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a proposed change to ensure the Flask server can be shutdown without bringing down the whole process.