From d748e54b48fddc90031cbda3001494b20dfb237a Mon Sep 17 00:00:00 2001 From: Ryan Schlesinger Date: Mon, 26 Jan 2015 13:17:54 -0800 Subject: [PATCH] =?UTF-8?q?Clarify=20middleware=E2=80=99s=20role;=20fix=20?= =?UTF-8?q?busted=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/sidekiq/client.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/sidekiq/client.rb b/lib/sidekiq/client.rb index 48db42d4..f59c7060 100644 --- a/lib/sidekiq/client.rb +++ b/lib/sidekiq/client.rb @@ -55,7 +55,7 @@ module Sidekiq # All options must be strings, not symbols. NB: because we are serializing to JSON, all # symbols in 'args' will be converted to strings. # - # Returns a unique Job ID. + # Returns a unique Job ID. If middleware stops the job, nil will be returned instead. # # Example: # push('queue' => 'my_queue', 'class' => MyWorker, 'args' => ['foo', 1, :bat => 'bar']) @@ -64,8 +64,10 @@ module Sidekiq normed = normalize_item(item) payload = process_single(item['class'], normed) - raw_push([payload]) if payload - payload['jid'] + if payload + raw_push([payload]) + payload['jid'] + end end ##