Class: Webhookdb::Jobs::SendWebhook

Inherits:
Object
  • Object
show all
Extended by:
Async::Job
Includes:
Amigo::DurableJob
Defined in:
lib/webhookdb/jobs/send_webhook.rb

Instance Method Summary collapse

Methods included from Async::Job

extended

Methods included from Amigo::DurableJob

enabled?, ensure_jobs_tables, heartbeat, heartbeat!, included, insert_job, lock_job, poll_jobs, reconnect, replace_database_settings, set_database_setting, storage_datasets, unlock_job

Instance Method Details

#_perform(event) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/webhookdb/jobs/send_webhook.rb', line 11

def _perform(event)
  sint = self.lookup_model(Webhookdb::ServiceIntegration, event)
  self.with_log_tags(sint.log_tags) do
    sint.all_webhook_subscriptions_dataset.to_notify.each do |sub|
      payload = {service_name: sint.service_name, table_name: sint.table_name, **event.payload[1]}
      sub.enqueue_delivery(payload)
    end
  end
end