Class: Sidekiq::Work

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq/api.rb

Overview

Sidekiq::Work represents a job which is currently executing.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pid, tid, hsh) ⇒ Work

Returns a new instance of Work.



1241
1242
1243
1244
1245
1246
# File 'lib/sidekiq/api.rb', line 1241

def initialize(pid, tid, hsh)
  @process_id = pid
  @thread_id = tid
  @hsh = hsh
  @job = nil
end

Instance Attribute Details

#process_idObject (readonly)

Returns the value of attribute process_id.



1238
1239
1240
# File 'lib/sidekiq/api.rb', line 1238

def process_id
  @process_id
end

#thread_idObject (readonly)

Returns the value of attribute thread_id.



1239
1240
1241
# File 'lib/sidekiq/api.rb', line 1239

def thread_id
  @thread_id
end

Instance Method Details

#jobObject



1256
1257
1258
# File 'lib/sidekiq/api.rb', line 1256

def job
  @job ||= Sidekiq::JobRecord.new(@hsh["payload"])
end

#payloadObject



1260
1261
1262
# File 'lib/sidekiq/api.rb', line 1260

def payload
  @hsh["payload"]
end

#queueObject



1248
1249
1250
# File 'lib/sidekiq/api.rb', line 1248

def queue
  @hsh["queue"]
end

#run_atObject



1252
1253
1254
# File 'lib/sidekiq/api.rb', line 1252

def run_at
  Time.at(@hsh["run_at"])
end