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.



1322
1323
1324
1325
1326
1327
# File 'lib/sidekiq/api.rb', line 1322

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.



1319
1320
1321
# File 'lib/sidekiq/api.rb', line 1319

def process_id
  @process_id
end

#thread_idObject (readonly)

Returns the value of attribute thread_id.



1320
1321
1322
# File 'lib/sidekiq/api.rb', line 1320

def thread_id
  @thread_id
end

Instance Method Details

#jobObject



1337
1338
1339
# File 'lib/sidekiq/api.rb', line 1337

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

#payloadObject



1341
1342
1343
# File 'lib/sidekiq/api.rb', line 1341

def payload
  @hsh["payload"]
end

#queueObject



1329
1330
1331
# File 'lib/sidekiq/api.rb', line 1329

def queue
  @hsh["queue"]
end

#run_atObject



1333
1334
1335
# File 'lib/sidekiq/api.rb', line 1333

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