Refactor Geo::BaseSyncService#update_registry

parent 010d58e8
......@@ -50,16 +50,18 @@ module Geo
log("Updating #{type} sync information")
if started_at
registry.public_send("last_#{type}_synced_at=", started_at)
attrs = {}.tap do |attrs|
if started_at
attrs["last_#{type}_synced_at"] = started_at
end
if finished_at
attrs["last_#{type}_successful_sync_at"] = finished_at
attrs["resync_#{type}"] = false
end
end
if finished_at
registry.public_send("last_#{type}_successful_sync_at=", finished_at)
registry.public_send("resync_#{type}=", false)
end
registry.save!
registry.update!(attrs)
end
def lease_key
......
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