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

default timeout too long > 300 days #12

Open
robshep opened this issue Jun 4, 2019 · 0 comments
Open

default timeout too long > 300 days #12

robshep opened this issue Jun 4, 2019 · 0 comments

Comments

@robshep
Copy link

robshep commented Jun 4, 2019

The default timeout is int: 300

See: https://github.com/kapilt/mongoqueue/blob/master/mongoqueue/mongoqueue.py#L34

It is used to find locked jobs which have expired here:
https://github.com/kapilt/mongoqueue/blob/master/mongoqueue/mongoqueue.py#L66

the use of one unnamed parameter to timedelta means it takes the argument as 'days'

The only way to get sub-day timeouts is to use day fraction.

See some examples here:

>>> from datetime import datetime, timedelta
>>> datetime.now()
datetime.datetime(2019, 6, 4, 17, 54, 52, 339957)

>>> datetime.now() - timedelta(300) # the default
datetime.datetime(2018, 8, 8, 17, 55, 4, 593967)

>>> datetime.now() - timedelta(1) # 1 day
datetime.datetime(2019, 6, 3, 17, 55, 12, 929884)

>>> datetime.now() - timedelta(0.04166667) # 1 hour as decimal days
datetime.datetime(2019, 6, 4, 16, 55, 39, 443801)

Please consider defaulting to a lower time-base like hours.

I had assumed it was minutes. (5hrs)

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

No branches or pull requests

1 participant