Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix #74 using the "bandaid" solution #76

Merged
merged 1 commit into from

2 participants

Ben Kirzhner Myron Marston
Ben Kirzhner
Owner

No description provided.

Myron Marston myronmarston merged commit 34faabc into from
Myron Marston myronmarston deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 31, 2013
  1. Ben Kirzhner

    Fixes #74

    benkirzhner authored
This page is out of date. Refresh to see the latest.
4 lib/qless/worker.rb
View
@@ -144,6 +144,8 @@ def unpause_processing
def retryable_exception_classes(job)
return [] unless job.klass.respond_to?(:retryable_exception_classes)
job.klass.retryable_exception_classes
+ rescue NameError => exn
+ []
end
def try_complete(job)
@@ -169,7 +171,7 @@ def around_perform(job)
}
def fail_job(job, error)
- group = "#{job.klass}:#{error.class}"
+ group = "#{job.klass_name}:#{error.class}"
message = "#{error.message}\n\n#{error.backtrace.join("\n")}"
log "Got #{group} failure from #{job.inspect}"
job.fail(group, message)
2  spec/unit/job_spec.rb
View
@@ -39,7 +39,7 @@ class Nested
stub_const("MyJobClass", Class.new)
job = Job.build(client, ::MyJobClass, data: {})
hide_const("MyJobClass")
- expect { job.klass }.to raise_error(/constant MyJobClass/)
+ expect { job.klass }.to raise_error(NameError, /constant MyJobClass/)
end
end
6 spec/unit/worker_spec.rb
View
@@ -94,6 +94,12 @@ class MyJobClass; end
worker.perform(job)
end
+ it 'fails the job if the job class is invalid or not found' do
+ hide_const('Qless::MyJobClass')
+ job.should_receive(:fail)
+ expect { worker.perform(job) }.not_to raise_error
+ end
+
it 'does not complete the job if the job logic itself changes the state of it (e.g. moves it to a new queue)' do
MyJobClass.stub(:perform) { |j| j.move("other") }
job.should_not_receive(:complete)
Something went wrong with that request. Please try again.