Module: Delayed::Backend::Base
- Included in:
- ActiveRecord::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
27 28 29 |
# File 'lib/delayed/backend/base.rb', line 27 def failed? failed_at end |
#invoke_job ⇒ Object
Moved into its own method so that new_relic can trace it.
52 53 54 |
# File 'lib/delayed/backend/base.rb', line 52 def invoke_job payload_object.perform end |
#name ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/delayed/backend/base.rb', line 36 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
32 33 34 |
# File 'lib/delayed/backend/base.rb', line 32 def payload_object @payload_object ||= deserialize(self['handler']) end |
#payload_object=(object) ⇒ Object
47 48 49 |
# File 'lib/delayed/backend/base.rb', line 47 def payload_object=(object) self['handler'] = object.to_yaml end |
#unlock ⇒ Object
Unlock this job (note: not saved to DB)
57 58 59 60 |
# File 'lib/delayed/backend/base.rb', line 57 def unlock self.locked_at = nil self.locked_by = nil end |