Sha256: 0eb87a1786c0803b80aa757dc3bcbed25e24537eb190cacba5b55921ee204f05
Contents?: true
Size: 1.05 KB
Versions: 7
Compression:
Stored size: 1.05 KB
Contents
require 'minitest' require "minitest/autorun" require 'pry' $:.unshift(".") require 'resque_stuck_queue' require File.join(File.expand_path(File.dirname(__FILE__)), "resque", "set_redis_key") require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper") class TestLagTime < Minitest::Test include TestHelper def setup Resque::StuckQueue.config[:redis] = Redis.new Resque::StuckQueue.redis.flushall Resque::StuckQueue.config[:abort_on_exception] = true Resque::StuckQueue.config[:watcher_interval] = 1 end def test_triggers_handler_with_lagtime Resque::StuckQueue.config[:trigger_timeout] = 2 # won't allow waiting too much and will complain (eg trigger) sooner than later Resque::StuckQueue.config[:heartbeat_interval] = 1 @lagtime = 0 Resque::StuckQueue.config[:triggered_handler] = proc { |queue_name, lagtime| @lagtime = lagtime } start_and_stop_loops_after(5) # check handler did get called assert @lagtime > 0, "lagtime shoudl be set" assert @lagtime < 5, "lagtime shoudl be set" end end
Version data entries
7 entries across 7 versions & 2 rubygems