Class: OnlineMigrations::BackgroundMigrations::Config
- Inherits:
-
Object
- Object
- OnlineMigrations::BackgroundMigrations::Config
- Defined in:
- lib/online_migrations/background_migrations/config.rb
Overview
Class representing configuration options for background migrations.
Instance Attribute Summary collapse
-
#batch_max_attempts ⇒ Integer
Maximum number of batch run attempts.
-
#batch_pause ⇒ Integer
The pause interval between each background migration job's execution (in seconds).
-
#batch_size ⇒ Integer
The number of rows to process in a single background migration run.
-
#error_handler ⇒ Proc
The callback to perform when an error occurs in the migration job.
-
#migrations_module ⇒ String
The module in which background migrations will be placed.
-
#migrations_path ⇒ String
The path where generated background migrations will be placed.
-
#stuck_jobs_timeout ⇒ Integer
The number of seconds that must pass before the running job is considered stuck.
-
#sub_batch_pause_ms ⇒ Integer
The number of milliseconds to sleep between each sub_batch execution.
-
#sub_batch_size ⇒ Integer
The smaller batches size that the batches will be divided into.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/online_migrations/background_migrations/config.rb', line 61 def initialize @migrations_path = "lib" @migrations_module = "OnlineMigrations::BackgroundMigrations" @batch_size = 1_000 @sub_batch_size = 100 @batch_pause = 0.seconds @sub_batch_pause_ms = 100 @batch_max_attempts = 5 @stuck_jobs_timeout = 1.hour @error_handler = ->(error, errored_job) {} end |
Instance Attribute Details
#batch_max_attempts ⇒ Integer
Maximum number of batch run attempts
When attempts are exhausted, the individual batch is marked as failed.
40 41 42 |
# File 'lib/online_migrations/background_migrations/config.rb', line 40 def batch_max_attempts @batch_max_attempts end |
#batch_pause ⇒ Integer
The pause interval between each background migration job's execution (in seconds)
28 29 30 |
# File 'lib/online_migrations/background_migrations/config.rb', line 28 def batch_pause @batch_pause end |
#batch_size ⇒ Integer
The number of rows to process in a single background migration run
18 19 20 |
# File 'lib/online_migrations/background_migrations/config.rb', line 18 def batch_size @batch_size end |
#error_handler ⇒ Proc
The callback to perform when an error occurs in the migration job.
59 60 61 |
# File 'lib/online_migrations/background_migrations/config.rb', line 59 def error_handler @error_handler end |
#migrations_module ⇒ String
The module in which background migrations will be placed
13 14 15 |
# File 'lib/online_migrations/background_migrations/config.rb', line 13 def migrations_module @migrations_module end |
#migrations_path ⇒ String
The path where generated background migrations will be placed
9 10 11 |
# File 'lib/online_migrations/background_migrations/config.rb', line 9 def migrations_path @migrations_path end |
#stuck_jobs_timeout ⇒ Integer
The number of seconds that must pass before the running job is considered stuck
46 47 48 |
# File 'lib/online_migrations/background_migrations/config.rb', line 46 def stuck_jobs_timeout @stuck_jobs_timeout end |
#sub_batch_pause_ms ⇒ Integer
The number of milliseconds to sleep between each sub_batch execution
33 34 35 |
# File 'lib/online_migrations/background_migrations/config.rb', line 33 def sub_batch_pause_ms @sub_batch_pause_ms end |
#sub_batch_size ⇒ Integer
The smaller batches size that the batches will be divided into
23 24 25 |
# File 'lib/online_migrations/background_migrations/config.rb', line 23 def sub_batch_size @sub_batch_size end |