Module: Wurk::Scheduled

Defined in:
lib/wurk/scheduled.rb

Overview

Promotes due jobs from the retry and schedule sorted sets back onto their target queues. One Poller thread per process; collectively they drain both SETS through a Lua claim (loaded via the EVALSHA cache, retried once on NOSCRIPT). Polling cadence scales with cluster size so total scheduler traffic stays constant as processes are added.

Spec: docs/target/sidekiq-free.md ยง16. Pluggable via config[:scheduled_enq].

Defined Under Namespace

Classes: Enq, Poller, ReliableEnq

Constant Summary collapse

SETS =
%w[retry schedule].freeze
LUA_ZPOPBYSCORE =

Source must match Wurk::Lua::ZPOPBYSCORE byte-for-byte: they share a SHA.

Wurk::Lua::ZPOPBYSCORE

Class Method Summary collapse

Class Method Details

.record_promotions(sset, count) ⇒ Object

Promotions per set, for /metrics (wurk_scheduler_promoted_total).



23
24
25
# File 'lib/wurk/scheduled.rb', line 23

def self.record_promotions(sset, count)
  Metrics::ProcessCounters.increment([:scheduler_promoted, sset], count) if count.positive?
end