16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/webhookdb/jobs/sync_target_run_sync.rb', line 16
def perform(sync_target_id)
stgt = Webhookdb::SyncTarget[sync_target_id]
if stgt.nil?
self.logger.info("missing_sync_target", sync_target_id:)
return
end
self.with_log_tags(
sync_target_id: stgt.id,
sync_target_connection_url: stgt.displaysafe_connection_url,
sync_target_service_integration_service: stgt.service_integration.service_name,
sync_target_service_integration_table: stgt.service_integration.table_name,
) do
stgt.run_sync(now: Time.now)
rescue Webhookdb::SyncTarget::SyncInProgress
Webhookdb::Idempotency.every(30.seconds).in_memory.under_key("sync_target_in_progress-#{stgt.id}") do
self.logger.info("sync_target_already_in_progress")
end
rescue Webhookdb::SyncTarget::Deleted
self.logger.info("sync_target_deleted")
end
end
|