Class: Webhookdb::Jobs::ReplicationMigration
- Inherits:
-
Object
- Object
- Webhookdb::Jobs::ReplicationMigration
- Includes:
- Sidekiq::Worker
- 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
Class Method Details
.migrate_org(org) ⇒ Object
To make mocking easier.
21 22 23 |
# File 'lib/webhookdb/jobs/replication_migration.rb', line 21 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 |
# 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) if target_rca == current_rca self.class.migrate_org(org) elsif target_rca > current_rca self.class.perform_in(1, org_id, target_release_created_at) else self.logger.warn("stale_replication_migration_job", target_release_created_at:) end end |