mirror of
https://github.com/plashchynski/crono.git
synced 2026-03-25 10:52:28 +01:00
Add ability to define minimal time between job executions to support multiple corno nodes, so two different nodes will not execute the same job
Add Locking for the case that two nodes start perform job together. If execution_interval == 0.minutes, skip locking and immediately perform
This commit is contained in:
@@ -107,6 +107,8 @@ module Crono
|
||||
end
|
||||
|
||||
def perform_before_interval?
|
||||
return false if execution_interval == 0.minutes
|
||||
|
||||
return true if self.last_performed_at.present? && self.last_performed_at > execution_interval.ago
|
||||
return true if model.updated_at.present? && model.created_at != model.updated_at && model.updated_at > execution_interval.ago
|
||||
|
||||
|
||||
Reference in New Issue
Block a user