Class: Wurk::Batch::ServerMiddleware
- Inherits:
-
Object
- Object
- Wurk::Batch::ServerMiddleware
- Includes:
- Middleware::ServerMiddleware
- Defined in:
- lib/wurk/batch/server_middleware.rb
Overview
Server middleware. Runs around ‘perform` for any job carrying a `bid`. On success → BATCH_ACK_SUCCESS → if pending hit zero and no deaths, enqueue `:success` callback jobs; if live jids hit zero, enqueue `:complete` callback jobs.
Invalidated batches short-circuit: the job is skipped without raising — counts as a “success” for batch purposes per spec §12.
Death handling lives in Wurk::Batch::DeathHandler (registered as a config death_handler) because death is signalled from the retry layer, not from this middleware’s rescue path.
Instance Attribute Summary
Attributes included from Middleware::ServerMiddleware
Instance Method Summary collapse
Methods included from Middleware::ServerMiddleware
Instance Method Details
#call(_worker, job, _queue) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/wurk/batch/server_middleware.rb', line 23 def call(_worker, job, _queue) bid = job['bid'] return yield unless bid if invalidated?(bid) ack_success(bid, job['jid']) return end yield ack_success(bid, job['jid']) end |