Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Remove fast-fallback.

  • Loading branch information...
commit 44358ae39166ceece9a5fbba307341e43cae5d70 1 parent aa7225f
authored October 05, 2010

Showing 1 changed file with 3 additions and 12 deletions. Show diff stats Hide diff stats

  1. 15  lib/kestrel/client/transactional.rb
15  lib/kestrel/client/transactional.rb
@@ -34,9 +34,7 @@ def initialize(client, max_retries = nil, error_rate = nil)
34 34
 
35 35
   # Returns job from the +key+ queue 1 - ERROR_PROCESSING_RATE
36 36
   # pct. of the time. Every so often, checks the error queue for
37  
-  # jobs and returns a retryable job. If either the error queue or
38  
-  # +key+ queue are empty, attempts to pull a job from the
39  
-  # alternate queue before giving up.
  37
+  # jobs and returns a retryable job.
40 38
   #
41 39
   # ==== Returns
42 40
   # Job, possibly retryable, or nil
@@ -46,9 +44,9 @@ def get(key, opts = {})
46 44
 
47 45
     close_transaction(current_try == 1 ? key : "#{key}_errors")
48 46
 
49  
-    q1, q2 = (rand < @error_rate) ? [key + "_errors", key] : [key, key + "_errors"]
  47
+    queue = (rand < @error_rate) ? key + "_errors" : key
50 48
 
51  
-    if job = get_with_fallback(q1, q2, opts.merge(:close => true, :open => true))
  49
+    if job = get(queue, opts.merge(:open => true))
52 50
       @current_queue = key
53 51
       @job = job.is_a?(RetryableJob) ? job : RetryableJob.new(0, job)
54 52
       @job.job
@@ -93,13 +91,6 @@ def retry(item = nil)
93 91
 
94 92
   private
95 93
 
96  
-  # If a get against the +primary+ queue is nil, falls back to the
97  
-  # +secondary+ queue.
98  
-  #
99  
-  def get_with_fallback(primary, secondary, opts) #:nodoc:
100  
-    client.get(primary, opts) || client.get(secondary, opts)
101  
-  end
102  
-
103 94
   def close_transaction(key) #:nodoc:
104 95
     client.get_from_last("#{key}/close")
105 96
   end

0 notes on commit 44358ae

Please sign in to comment.
Something went wrong with that request. Please try again.