diff options
author | Adam Winberg <adam.winberg@smhi.se> | 2016-05-27 13:00:25 +0200 |
---|---|---|
committer | Adam Winberg <adam.winberg@smhi.se> | 2016-05-27 13:00:25 +0200 |
commit | 51f4c2d0ba810c97000c3f5db37b198938683c13 (patch) | |
tree | 1662ce8273490e54e2b9f885fb75015e3ae219ae /lib/oxidized/worker.rb | |
parent | f16660a2113321c4f0a1a5eaa7ef51048d25fa7c (diff) |
Added feature to disable polling based on interval
Diffstat (limited to 'lib/oxidized/worker.rb')
-rw-r--r-- | lib/oxidized/worker.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/oxidized/worker.rb b/lib/oxidized/worker.rb index 324dcb5..48852ef 100644 --- a/lib/oxidized/worker.rb +++ b/lib/oxidized/worker.rb @@ -18,7 +18,9 @@ module Oxidized # ask for next node in queue non destructive way nextnode = @nodes.first unless nextnode.last.nil? - break if nextnode.last.end + Oxidized.config.interval > Time.now.utc + # Set unobtainable value for 'last' if interval checking is disabled + last = Oxidized.config.interval == 0 ? Time.now.utc + 10 : nextnode.last.end + break if last + Oxidized.config.interval > Time.now.utc end # shift nodes and get the next node node = @nodes.get |