Sha256: 0f77a18cbcd7c3d93f2b648452a55dbc7f3398529e4120932254104b41aaa1bb
Contents?: true
Size: 613 Bytes
Versions: 1
Compression:
Stored size: 613 Bytes
Contents
# frozen_string_literal: true module Boatload # A timer that will periodically tell the Worker to process messages. class Timer def initialize(queue:, delivery_interval:, logger:) @logger = logger @queue = queue @delivery_interval = delivery_interval end def run Thread.stop if @delivery_interval.zero? @logger.info 'Starting Timer...' loop do sleep @delivery_interval @queue.push [:process, nil] end rescue StandardError => e @logger.error "Timer thread encountered an unexpected error:\n#{e.full_message}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
boatload-0.1.0 | lib/boatload/timer.rb |