Class: OnlineMigrations::BackgroundMigrations::MigrationJob
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- OnlineMigrations::BackgroundMigrations::MigrationJob
- Defined in:
- lib/online_migrations/background_migrations/migration_job.rb
Constant Summary collapse
- STATUSES =
[ :enqueued, :running, :failed, :succeeded, ]
Instance Method Summary collapse
-
#retry ⇒ Object
Mark this job as ready to be processed again.
-
#stuck? ⇒ Boolean
Whether the job is considered stuck (is running for some configured time).
Instance Method Details
#retry ⇒ Object
Mark this job as ready to be processed again.
This is used when retrying failed jobs.
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/online_migrations/background_migrations/migration_job.rb', line 71 def retry update!( status: self.class.statuses[:enqueued], attempts: 0, started_at: nil, finished_at: nil, error_class: nil, error_message: nil, backtrace: nil ) end |
#stuck? ⇒ Boolean
Whether the job is considered stuck (is running for some configured time).
62 63 64 65 |
# File 'lib/online_migrations/background_migrations/migration_job.rb', line 62 def stuck? timeout = OnlineMigrations.config.background_migrations.stuck_jobs_timeout running? && updated_at <= timeout.seconds.ago end |