Module: Sidekiq::Status::Worker
- Includes:
- Storage
- Defined in:
- lib/sidekiq-status/worker.rb
Defined Under Namespace
Classes: Stopped
Constant Summary
Constants included from Storage
Storage::BATCH_LIMIT, Storage::RESERVED_FIELDS
Instance Attribute Summary collapse
-
#expiration ⇒ Object
Returns the value of attribute expiration.
Instance Method Summary collapse
-
#at(num, message = nil) ⇒ String
Sets current task progress (inspired by resque-status).
-
#retrieve(name) ⇒ String
Read value from job status hash.
-
#store(hash) ⇒ String
Stores multiple values into a job’s status hash, sets last update time.
-
#total(num) ⇒ String
Sets total number of tasks.
Instance Attribute Details
#expiration ⇒ Object
Returns the value of attribute expiration.
7 8 9 |
# File 'lib/sidekiq-status/worker.rb', line 7 def expiration @expiration end |
Instance Method Details
#at(num, message = nil) ⇒ String
Sets current task progress (inspired by resque-status)
29 30 31 32 |
# File 'lib/sidekiq-status/worker.rb', line 29 def at(num, = nil) total(100) if retrieve(:total).nil? store(at: num, message: ) end |
#retrieve(name) ⇒ String
Read value from job status hash
20 21 22 |
# File 'lib/sidekiq-status/worker.rb', line 20 def retrieve(name) read_field_for_id @jid, name end |
#store(hash) ⇒ String
Stores multiple values into a job’s status hash, sets last update time
13 14 15 |
# File 'lib/sidekiq-status/worker.rb', line 13 def store(hash) store_for_id @jid, hash, @expiration end |
#total(num) ⇒ String
Sets total number of tasks
37 38 39 |
# File 'lib/sidekiq-status/worker.rb', line 37 def total(num) store(total: num) end |