Module: Delayed::Backend::Base
- Included in:
- ActiveRecord::Job, DataMapper::Job, MongoMapper::Job
- Defined in:
- lib/delayed/backend/base.rb
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- ParseObjectFromYaml =
/\!ruby\/\w+\:([^\s]+)/
Class Method Summary collapse
Instance Method Summary collapse
- #failed? ⇒ Boolean (also: #failed)
-
#invoke_job ⇒ Object
Moved into its own method so that new_relic can trace it.
- #name ⇒ Object
- #payload_object ⇒ Object
- #payload_object=(object) ⇒ Object
-
#unlock ⇒ Object
Unlock this job (note: not saved to DB).
Class Method Details
.included(base) ⇒ Object
7 8 9 |
# File 'lib/delayed/backend/base.rb', line 7 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#failed? ⇒ Boolean Also known as: failed
40 41 42 |
# File 'lib/delayed/backend/base.rb', line 40 def failed? failed_at end |
#invoke_job ⇒ Object
Moved into its own method so that new_relic can trace it.
65 66 67 |
# File 'lib/delayed/backend/base.rb', line 65 def invoke_job payload_object.perform end |
#name ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/delayed/backend/base.rb', line 49 def name @name ||= begin payload = payload_object if payload.respond_to?(:display_name) payload.display_name else payload.class.name end end end |
#payload_object ⇒ Object
45 46 47 |
# File 'lib/delayed/backend/base.rb', line 45 def payload_object @payload_object ||= deserialize(self['handler']) end |
#payload_object=(object) ⇒ Object
60 61 62 |
# File 'lib/delayed/backend/base.rb', line 60 def payload_object=(object) self['handler'] = object.to_yaml end |
#unlock ⇒ Object
Unlock this job (note: not saved to DB)
70 71 72 73 |
# File 'lib/delayed/backend/base.rb', line 70 def unlock self.locked_at = nil self.locked_by = nil end |