Class: Webhookdb::Jobs::ReplicationMigration
- Inherits:
-
Object
- Object
- Webhookdb::Jobs::ReplicationMigration
- Extended by:
- Async::Job
- Defined in:
- lib/webhookdb/jobs/replication_migration.rb
Overview
See Organization::enqueue_migrate_all_replication_tables for more info.
Class Method Summary collapse
-
.migrate_org(org) ⇒ Object
To make mocking easier.
Instance Method Summary collapse
Methods included from Async::Job
Class Method Details
.migrate_org(org) ⇒ Object
To make mocking easier.
24 25 26 |
# File 'lib/webhookdb/jobs/replication_migration.rb', line 24 def self.migrate_org(org) org.migrate_replication_tables end |
Instance Method Details
#perform(org_id, target_release_created_at) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/webhookdb/jobs/replication_migration.rb', line 7 def perform(org_id, target_release_created_at) (org = Webhookdb::Organization[org_id]) or raise "Organization[#{org_id}] does not exist" target_rca = Time.parse(target_release_created_at) current_rca = Time.parse(Webhookdb::RELEASE_CREATED_AT) self.(organization_id: org_id, target_release_created_at:) if target_rca == current_rca self.class.migrate_org(org) self.(result: "ran_replication_migration_job") elsif target_rca > current_rca self.class.perform_in(1, org_id, target_release_created_at) self.(result: "reenqueued_replication_migration_job") else self.(result: "stale_replication_migration_job") end end |