1
0
Fork 0
mirror of https://github.com/endofunky/sidetiq.git synced 2022-11-09 13:53:30 -05:00

Adjust clock sleep based on schedule processing.

This commit is contained in:
Tobias Svensson 2013-02-08 09:33:36 +00:00
parent 3c506f5bad
commit 22bae20d15

View file

@ -160,11 +160,20 @@ module Sidetiq
def clock
loop do
yield
Thread.pass
sleep Sidetiq.config.resolution
sleep_time = time { yield }
if sleep_time > 0
Thread.pass
sleep sleep_time
end
end
end
def time
start = gettime
yield
Sidetiq.config.resolution - (gettime.to_f - start.to_f)
end
end
end