GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Fork of dustin/beanstalk-client-ruby
Description: Ruby client for beanstalkd
Homepage: http://xph.us/software/beanstalkd/
Clone URL: git://github.com/kr/beanstalk-client-ruby.git
Pool methods for the new peek commands.
kr (author)
Thu Apr 10 16:27:29 -0700 2008
commit  6627cda47a209219933883848e5c5e3430b90f56
tree    163a9dcbddc0d4d1478a12332f899947f6df0339
parent  9fc1e6d77331e2f941ddc3dcddacbc8566c4de12
...
312
313
314
315
316
317
318
319
320
 
 
 
 
 
 
 
 
 
 
321
322
323
...
326
327
328
 
 
 
 
 
 
 
 
329
330
331
...
312
313
314
 
 
 
 
 
 
315
316
317
318
319
320
321
322
323
324
325
326
327
...
330
331
332
333
334
335
336
337
338
339
340
341
342
343
0
@@ -312,12 +312,16 @@ module Beanstalk
0
       end
0
     end
0
 
0
- def peek()
0
- open_connections.each do |c|
0
- job = c.peek
0
- return job if job
0
- end
0
- nil
0
+ def peek_ready()
0
+ send_to_each_conn_first_res(:peek_ready)
0
+ end
0
+
0
+ def peek_delayed()
0
+ send_to_each_conn_first_res(:peek_delayed)
0
+ end
0
+
0
+ def peek_buried()
0
+ send_to_each_conn_first_res(:peek_buried)
0
     end
0
 
0
     def peek_job(id)
0
@@ -326,6 +330,14 @@ module Beanstalk
0
 
0
     private
0
 
0
+ def send_to_each_conn_first_res(sel, *args)
0
+ open_connections.each do |c|
0
+ x = wrap(c, sel, *args)
0
+ return x if x
0
+ end
0
+ nil
0
+ end
0
+
0
     def send_to_rand_conn(sel, *args)
0
       wrap(pick_connection, sel, *args)
0
     end

Comments

    No one has commented yet.