Class: Wurk::Scheduled::Enq
- Inherits:
-
Object
- Object
- Wurk::Scheduled::Enq
- Includes:
- Component
- Defined in:
- lib/wurk/scheduled.rb
Overview
Drains both SETS each call. Iterates per-set inside a single pooled checkout so the EVALSHA + LPUSH loop avoids re-checkout per job.
Constant Summary collapse
- LUA_ZPOPBYSCORE =
Wurk::Lua::ZPOPBYSCORE
Constants included from Component
Component::DEFAULT_THREAD_PRIORITY, Component::PROCESS_NONCE
Instance Attribute Summary
Attributes included from Component
Instance Method Summary collapse
-
#enqueue_jobs(sorted_sets = SETS) ⇒ Object
Pops every due job from each sorted set and re-pushes through the client.
-
#initialize(container) ⇒ Enq
constructor
A new instance of Enq.
- #terminate ⇒ Object
Methods included from Component
#default_tag, #fire_event, #handle_exception, #hostname, #identity, #leader?, #logger, #mono_ms, #process_nonce, #real_ms, #redis, #safe_thread, #tid, #watchdog
Constructor Details
Instance Method Details
#enqueue_jobs(sorted_sets = SETS) ⇒ Object
Pops every due job from each sorted set and re-pushes through the client. ‘now` is captured once per set so a slow loop on one ZSET can’t keep grabbing newly-scheduled jobs from a moving window.
41 42 43 44 45 |
# File 'lib/wurk/scheduled.rb', line 41 def enqueue_jobs(sorted_sets = SETS) @config.redis do |conn| sorted_sets.each { |sset| drain_set(conn, sset) } end end |
#terminate ⇒ Object
47 48 49 |
# File 'lib/wurk/scheduled.rb', line 47 def terminate @done = true end |