Use find_or_initialize_by to save one query when tracking projects

parent 9ec269a8
......@@ -86,7 +86,7 @@ module Geo
def update_registry(started_at, finished_at)
log('Updating registry information')
registry = Geo::ProjectRegistry.find_or_create_by(project_id: project.id)
registry = Geo::ProjectRegistry.find_or_initialize_by(project_id: project.id)
registry.last_repository_synced_at = started_at
registry.last_repository_successful_sync_at = finished_at if finished_at
registry.save
......
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