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.
1187 1188 1189 1190 1191 1192 |
# File 'lib/sidekiq/api.rb', line 1187 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.
1184 1185 1186 |
# File 'lib/sidekiq/api.rb', line 1184 def process_id @process_id end |
#thread_id ⇒ Object (readonly)
Returns the value of attribute thread_id.
1185 1186 1187 |
# File 'lib/sidekiq/api.rb', line 1185 def thread_id @thread_id end |
Instance Method Details
#job ⇒ Object
1202 1203 1204 |
# File 'lib/sidekiq/api.rb', line 1202 def job @job ||= Sidekiq::JobRecord.new(@hsh["payload"]) end |
#payload ⇒ Object
1206 1207 1208 |
# File 'lib/sidekiq/api.rb', line 1206 def payload @hsh["payload"] end |
#queue ⇒ Object
1194 1195 1196 |
# File 'lib/sidekiq/api.rb', line 1194 def queue @hsh["queue"] end |
#run_at ⇒ Object
1198 1199 1200 |
# File 'lib/sidekiq/api.rb', line 1198 def run_at Time.at(@hsh["run_at"]) end |