Class: Webhookdb::Jobs::IcalendarDeleteStaleCancelledEvents

Inherits:
Object
  • Object
show all
Extended by:
Async::ScheduledJob
Defined in:
lib/webhookdb/jobs/icalendar_delete_stale_cancelled_events.rb

Constant Summary collapse

ADVISORY_LOCK_ID =
1_236_432_568

Instance Method Summary collapse

Methods included from Async::ScheduledJob

extended

Instance Method Details

#_performObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/webhookdb/jobs/icalendar_delete_stale_cancelled_events.rb', line 14

def _perform
  Webhookdb::ServiceIntegration.where(service_name: Webhookdb::Icalendar::EVENT_REPLICATORS).each do |sint|
    self.with_log_tags(sint.log_tags) do
      sint.replicator.with_advisory_lock(ADVISORY_LOCK_ID) do
        deleted_rows = sint.replicator.stale_row_deleter.run
        self.set_job_tags("#{sint.organization.key}_#{sint.table_name}" => deleted_rows)
      end
    end
  end
end