Refactor the node_enabled? method on Geo workers to make it more clear

parent 222aa91d
...@@ -153,7 +153,7 @@ class GeoFileDownloadDispatchWorker ...@@ -153,7 +153,7 @@ class GeoFileDownloadDispatchWorker
def node_enabled? def node_enabled?
# Only check every minute to avoid polling the DB excessively # Only check every minute to avoid polling the DB excessively
unless @last_enabled_check.present? && (Time.now - @last_enabled_check > 1.minute) unless @last_enabled_check.present? && @last_enabled_check > 1.minute.ago
@last_enabled_check = Time.now @last_enabled_check = Time.now
@current_node_enabled = nil @current_node_enabled = nil
end end
......
...@@ -75,7 +75,7 @@ class GeoRepositorySyncWorker ...@@ -75,7 +75,7 @@ class GeoRepositorySyncWorker
def node_enabled? def node_enabled?
# Only check every minute to avoid polling the DB excessively # Only check every minute to avoid polling the DB excessively
unless @last_enabled_check.present? && (Time.now - @last_enabled_check > 1.minute) unless @last_enabled_check.present? && @last_enabled_check > 1.minute.ago
@last_enabled_check = Time.now @last_enabled_check = Time.now
@current_node_enabled = nil @current_node_enabled = nil
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment