Class: Undertow::DrainJob
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- Undertow::DrainJob
- Defined in:
- lib/undertow/drain_job.rb
Overview
Drains the per-model Redis buffers and delivers batches of dirty IDs to each model’s configured on_drain handler.
Publishes two ActiveSupport::Notifications events:
drain.undertow — after a successful on_drain call ({ model:, ids:, deleted_ids: })
error.undertow — when on_drain raises ({ model:, exception: })
Instance Method Summary collapse
Instance Method Details
#perform ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/undertow/drain_job.rb', line 13 def perform # Release the lock before draining so the scheduler can enqueue another job # for IDs that arrive while this one is running. Buffer.release_drain_lock model_names = Buffer.pending_model_names return if model_names.empty? model_names.each { |name| drain_model(name) } end |