mongoqueue icon indicating copy to clipboard operation
mongoqueue copied to clipboard

default timeout too long > 300 days

Open robshep opened this issue 5 years ago • 0 comments

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)

robshep avatar Jun 04 '19 16:06 robshep