Class: Sidekiq::Work
- Inherits:
-
Object
- Object
- Sidekiq::Work
- Defined in:
- lib/sidekiq/api.rb
Overview
Sidekiq::Work represents a job which is currently executing.
Instance Attribute Summary collapse
-
#process_id ⇒ Object
readonly
Returns the value of attribute process_id.
-
#thread_id ⇒ Object
readonly
Returns the value of attribute thread_id.
Instance Method Summary collapse
-
#initialize(pid, tid, hsh) ⇒ Work
constructor
A new instance of Work.
- #job ⇒ Object
- #payload ⇒ Object
- #queue ⇒ Object
- #run_at ⇒ Object
Constructor Details
#initialize(pid, tid, hsh) ⇒ Work
Returns a new instance of Work.
1323 1324 1325 1326 1327 1328 |
# File 'lib/sidekiq/api.rb', line 1323 def initialize(pid, tid, hsh) @process_id = pid @thread_id = tid @hsh = hsh @job = nil end |
Instance Attribute Details
#process_id ⇒ Object (readonly)
Returns the value of attribute process_id.
1320 1321 1322 |
# File 'lib/sidekiq/api.rb', line 1320 def process_id @process_id end |
#thread_id ⇒ Object (readonly)
Returns the value of attribute thread_id.
1321 1322 1323 |
# File 'lib/sidekiq/api.rb', line 1321 def thread_id @thread_id end |
Instance Method Details
#job ⇒ Object
1338 1339 1340 |
# File 'lib/sidekiq/api.rb', line 1338 def job @job ||= Sidekiq::JobRecord.new(@hsh["payload"]) end |
#payload ⇒ Object
1342 1343 1344 |
# File 'lib/sidekiq/api.rb', line 1342 def payload @hsh["payload"] end |
#queue ⇒ Object
1330 1331 1332 |
# File 'lib/sidekiq/api.rb', line 1330 def queue @hsh["queue"] end |
#run_at ⇒ Object
1334 1335 1336 |
# File 'lib/sidekiq/api.rb', line 1334 def run_at Time.at(@hsh["run_at"]) end |