Permalink
Browse files

pop the job instead of receiving. this prevents other queues from pic…

…king up the message if it takes too long to process.
  • Loading branch information...
1 parent d836c8e commit cf6699a7ea883dad0bb8c6f7f8d3fc3ce419ccc0 Peter van Hardenberg committed Jun 14, 2010
Showing with 4 additions and 6 deletions.
  1. +1 −1 VERSION
  2. +3 −5 lib/squeese.rb
View
@@ -1 +1 @@
-0.2.2
+0.2.3
View
@@ -41,7 +41,7 @@ def work
end
def work_one_job
- msg = queue.receive
+ msg = queue.pop
# don't be CPU greedy on a quiet queue
unless msg
@@ -55,11 +55,9 @@ def work_one_job
handler = @@handlers[name]
raise(NoSuchJob, name) unless handler
handler.call(args)
- msg.delete
rescue => e
- log "Deleting failed job." if msg
log exception_message(e)
- msg.delete if msg
+ log "Deleted failed job." if msg
end
def log_job(name, args)
@@ -71,7 +69,7 @@ def log_job(name, args)
end
def log(msg)
- puts "[#{Time.now}] #{msg}"
+ puts "[Squeese][#{Time.now}] #{msg}"
end
def sqs

0 comments on commit cf6699a

Please sign in to comment.