From 0a2559b1938b2d418c057ac13addc371bbfd45e1 Mon Sep 17 00:00:00 2001 From: Mike Perham Date: Tue, 16 Apr 2019 08:42:29 -0700 Subject: [PATCH] Revert "Allow tests to override enqueued_at", fixes #4149 This reverts commit cfe53e5fadfe88c53b62608d1dfc75ecf2ac18a0. --- lib/sidekiq/client.rb | 2 +- test/test_web.rb | 13 ++----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/lib/sidekiq/client.rb b/lib/sidekiq/client.rb index b7f5f482..5ec4f0b7 100644 --- a/lib/sidekiq/client.rb +++ b/lib/sidekiq/client.rb @@ -198,7 +198,7 @@ module Sidekiq q = payloads.first['queue'] now = Time.now.to_f to_push = payloads.map do |entry| - entry['enqueued_at'] ||= now + entry['enqueued_at'] = now Sidekiq.dump_json(entry) end conn.sadd('queues', q) diff --git a/test/test_web.rb b/test/test_web.rb index 5cdd4adf..f593ab78 100644 --- a/test/test_web.rb +++ b/test/test_web.rb @@ -107,22 +107,13 @@ describe Sidekiq::Web do end it 'can display queues' do - assert Sidekiq::Client.push('queue' => :foo, 'class' => WebWorker, 'args' => [1, 3]) - - get '/queues' - assert_equal 200, last_response.status - assert_match(/foo/, last_response.body) - refute_match(/HardWorker/, last_response.body) - refute_match(/datetime/, last_response.body) - Sidekiq::Queue.new("foo").clear - assert Sidekiq::Client.push('queue' => :foo, 'class' => WebWorker, 'args' => [1, 3], 'enqueued_at' => Time.now.to_f - 65) get '/queues' assert_equal 200, last_response.status assert_match(/foo/, last_response.body) - refute_match(/WebWorker/, last_response.body) - assert_match(/datetime/, last_response.body) + refute_match(/HardWorker/, last_response.body) + assert_match(/seconds ago/, last_response.body) end it 'handles queue view' do