Class: Webhookdb::Jobs::PrepareDatabaseConnections

Inherits:
Object
  • Object
show all
Extended by:
Async::Job
Includes:
Amigo::DurableJob
Defined in:
lib/webhookdb/jobs/prepare_database_connections.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



13
14
15
16
17
18
19
20
21
# File 'lib/webhookdb/jobs/prepare_database_connections.rb', line 13

def _perform(event)
  org = self.lookup_model(Webhookdb::Organization, event)
  org.db.transaction do
    # If creating the public host fails, we end up with an orphaned database,
    # but that's not a big deal- we can eventually see it's empty/unlinked and drop it.
    org.prepare_database_connections(safe: true)
    org.create_public_host_cname(safe: true)
  end
end