class ChainedJob::StoreJobArguments
Attributes
array_of_job_arguments[R]
job_arguments_key[R]
job_tag[R]
Public Class Methods
new(job_arguments_key, job_tag, array_of_job_arguments)
click to toggle source
# 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
run(job_arguments_key, job_tag, array_of_job_arguments)
click to toggle source
# 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
Public Instance Methods
run()
click to toggle source
# 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.rpush(redis_key, Helpers.serialize(sublist)) end ChainedJob.redis.expire(redis_key, config.arguments_queue_expiration) end
Private Instance Methods
config()
click to toggle source
# File lib/chained_job/store_job_arguments.rb, line 47 def config ChainedJob.config end
job_key()
click to toggle source
# File lib/chained_job/store_job_arguments.rb, line 43 def job_key @job_key ||= Helpers.job_key(job_arguments_key) end
redis_key()
click to toggle source
# File lib/chained_job/store_job_arguments.rb, line 39 def redis_key @redis_key ||= Helpers.redis_key(job_key, job_tag) end
set_tag_list()
click to toggle source
# File lib/chained_job/store_job_arguments.rb, line 31 def set_tag_list ChainedJob.redis.sadd(tag_list, job_tag) end
tag_list()
click to toggle source
# File lib/chained_job/store_job_arguments.rb, line 35 def tag_list Helpers.tag_list(job_key) end