Module: Webhookdb::Jobs::ScheduledBackfills
- Defined in:
- lib/webhookdb/jobs/scheduled_backfills.rb
Overview
Create a single way to do the common task of automatic scheduled backfills. Each integration that needs automated backfills can add a specification here.
Defined Under Namespace
Classes: Spec
Class Method Summary collapse
Class Method Details
.install(spec) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/webhookdb/jobs/scheduled_backfills.rb', line 15 def self.install(spec) cls = Class.new do extend Webhookdb::Async::ScheduledJob cron spec.cron_expr splay spec.splay define_method(:_perform) do Webhookdb::ServiceIntegration.dataset.where_each(service_name: spec.service_name) do |sint| m = spec.recursive ? :create_recursive : :create Webhookdb::BackfillJob.send(m, service_integration: sint, incremental: spec.incremental).enqueue end end end Webhookdb::Jobs.const_set(spec.klass, cls) end |