Sha256: 1277237be1df754f6196577931a0e78914195db13d7c927670401a0f99a817b7

Contents?: true

Size: 585 Bytes

Versions: 6

Compression:

Stored size: 585 Bytes

Contents

require 'spec_helper'

describe Sidekiq::LimitFetch::Global::Monitor do
  let(:monitor) { described_class.start! ttl, timeout }
  let(:ttl) { 1 }
  let(:queue) { Sidekiq::Queue[name] }
  let(:name) { 'default' }

  before :each do
    monitor
  end

  after :each do
    monitor.kill
  end

  context 'old locks' do
    let(:timeout) { 0.5 }

    it 'should remove invalidated old locks' do
      2.times { queue.acquire }
      sleep 2*ttl
      queue.probed.should == 2

      described_class.stub :update_heartbeat
      sleep 2*ttl
      queue.probed.should == 0
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sidekiq-limit_fetch-2.1.1 spec/sidekiq/limit_fetch/global/monitor_spec.rb
sidekiq-limit_fetch-2.1.0 spec/sidekiq/limit_fetch/global/monitor_spec.rb
sidekiq-limit_fetch-2.0.2 spec/sidekiq/limit_fetch/global/monitor_spec.rb
sidekiq-limit_fetch-2.0.1 spec/sidekiq/limit_fetch/global/monitor_spec.rb
sidekiq-limit_fetch-2.0 spec/sidekiq/limit_fetch/global/monitor_spec.rb
sidekiq-limit_fetch-1.7 spec/sidekiq/limit_fetch/global/monitor_spec.rb