Class: ChainedJob::StoreJobArguments
- Inherits:
-
Object
- Object
- ChainedJob::StoreJobArguments
- Defined in:
- lib/chained_job/store_job_arguments.rb
Instance Attribute Summary collapse
-
#array_of_job_arguments ⇒ Object
readonly
Returns the value of attribute array_of_job_arguments.
-
#job_arguments_key ⇒ Object
readonly
Returns the value of attribute job_arguments_key.
-
#job_tag ⇒ Object
readonly
Returns the value of attribute job_tag.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(job_arguments_key, job_tag, array_of_job_arguments) ⇒ StoreJobArguments
constructor
A new instance of StoreJobArguments.
- #run ⇒ Object
Constructor Details
#initialize(job_arguments_key, job_tag, array_of_job_arguments) ⇒ StoreJobArguments
Returns a new instance of StoreJobArguments.
13 14 15 16 17 |
# File 'lib/chained_job/store_job_arguments.rb', line 13 def initialize(job_arguments_key, job_tag, array_of_job_arguments) @job_arguments_key = job_arguments_key @job_tag = job_tag @array_of_job_arguments = array_of_job_arguments end |
Instance Attribute Details
#array_of_job_arguments ⇒ Object (readonly)
Returns the value of attribute array_of_job_arguments.
11 12 13 |
# File 'lib/chained_job/store_job_arguments.rb', line 11 def array_of_job_arguments @array_of_job_arguments end |
#job_arguments_key ⇒ Object (readonly)
Returns the value of attribute job_arguments_key.
11 12 13 |
# File 'lib/chained_job/store_job_arguments.rb', line 11 def job_arguments_key @job_arguments_key end |
#job_tag ⇒ Object (readonly)
Returns the value of attribute job_tag.
11 12 13 |
# File 'lib/chained_job/store_job_arguments.rb', line 11 def job_tag @job_tag end |
Class Method Details
.run(job_arguments_key, job_tag, array_of_job_arguments) ⇒ Object
7 8 9 |
# File 'lib/chained_job/store_job_arguments.rb', line 7 def self.run(job_arguments_key, job_tag, array_of_job_arguments) new(job_arguments_key, job_tag, array_of_job_arguments).run end |
Instance Method Details
#run ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/chained_job/store_job_arguments.rb', line 19 def run set_tag_list array_of_job_arguments.each_slice(config.arguments_batch_size) do |sublist| ChainedJob.redis.call(:rpush, redis_key, Helpers.serialize(sublist)) end ChainedJob.redis.call(:expire, redis_key, config.arguments_queue_expiration) end |