closeio / tasktiger

Python task queue using Redis
MIT License
1.41k stars 80 forks source link

Inconsistent behavior in periodic function #308

Closed vishesh10 closed 9 months ago

vishesh10 commented 9 months ago

Description

periodic function returns inconsistent results with respect to next execution timestamps. For instance

dt = datetime.datetime(2010, 1, 1)
f = periodic(hours=5)
print(f[0](dt, *f[1]))

returns 2010-01-01 03:00:00 and

dt = datetime.datetime(2010, 1, 1)
f = periodic(hours=3)
print(f[0](dt, *f[1]))

also returns 2010-01-01 03:00:00

AlecRosenbaum commented 9 months ago

I'm not sure what I missing, these look like the same code block to me?

vishesh10 commented 9 months ago

Apologies for the confusion. I have updated the description.

AlecRosenbaum commented 9 months ago

I think it's just a coincidence in the numbers you picked that they come out the same (3 and 5 share a number of multiples)

image