Skip to content
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

Make daemon timeout configurable #953

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

petertdavies
Copy link
Collaborator

What was wrong?

The t8n daemon timeout can't be disabled.

How was it fixed?

Add a --timeout option to the daemon.

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

Comment on lines 88 to 97
if self.shutdown_timeout != 0:
while True:
time.sleep(11.0)
now = time.monotonic()
last_response = self.last_response
if last_response is None:
self.last_response = now
elif now - last_response > float(self.shutdown_timeout):
self.shutdown()
break
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if self.shutdown_timeout != 0:
while True:
time.sleep(11.0)
now = time.monotonic()
last_response = self.last_response
if last_response is None:
self.last_response = now
elif now - last_response > float(self.shutdown_timeout):
self.shutdown()
break
while self.shutdown_timeout != 0:
time.sleep(11.0)
now = time.monotonic()
last_response = self.last_response
if last_response is None:
self.last_response = now
elif now - last_response > float(self.shutdown_timeout):
self.shutdown()
break


def __init__(self, *args: Any, shutdown_timeout: int, **kwargs: Any) -> None:
self.shutdown_timeout = shutdown_timeout
self.last_response = time.monotonic()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this make the first check timeout if there is too much of a delay between creating the instance and starting the thread?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants