diff options
Diffstat (limited to 'lib/custodian')
-rw-r--r-- | lib/custodian/queue.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/custodian/queue.rb b/lib/custodian/queue.rb index 1ef9c61..1bdbee2 100644 --- a/lib/custodian/queue.rb +++ b/lib/custodian/queue.rb @@ -94,12 +94,16 @@ end def fetch(timeout = 1) job = nil - while( 1 ) + while( true ) foo, job = @redis.blpop( "queue", :timeout => timeout ) - return job if ( job ) - sleep( timeout ) + if ( job ) + return job + else + sleep( timeout ) + end + end end |