Class: ChainedJob::StoreJobArguments

Inherits:
Object
  • Object
show all
Defined in:
lib/chained_job/store_job_arguments.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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_argumentsObject (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_keyObject (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_tagObject (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

#runObject



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