diff --git a/lib/queue_classic/worker.rb b/lib/queue_classic/worker.rb index c8e28f1..9a4b639 100644 --- a/lib/queue_classic/worker.rb +++ b/lib/queue_classic/worker.rb @@ -111,7 +111,7 @@ def process(queue, job) finished = false begin call(job).tap do - queue.delete(job[:id]) + handle_success(queue, job) finished = true end rescue StandardError, ScriptError, NoMemoryError => e @@ -139,6 +139,10 @@ def call(job) receiver.send(message, *args) end + def handle_success(queue, job) + queue.delete(job[:id]) + end + # This method will be called when a StandardError, ScriptError or # NoMemoryError is raised during the execution of the job. def handle_failure(job,e)