Module: Lowkiq::Worker

Extended by:
ExtendTracker
Defined in:
lib/lowkiq/worker.rb

Instance Method Summary collapse

Methods included from ExtendTracker

extended, extended_modules

Instance Method Details

#client_actionsObject



35
36
37
# File 'lib/lowkiq/worker.rb', line 35

def client_actions
  Queue::Actions.new client_queue, client_queries
end

#client_queriesObject



31
32
33
# File 'lib/lowkiq/worker.rb', line 31

def client_queries
  Queue::Queries.new Lowkiq.client_redis_pool, self.queue_name
end

#client_queueObject



27
28
29
# File 'lib/lowkiq/worker.rb', line 27

def client_queue
  Queue::Queue.new Lowkiq.client_redis_pool, self.queue_name, self.shards_count
end

#perform(payload) ⇒ Object



23
24
25
# File 'lib/lowkiq/worker.rb', line 23

def perform(payload)
  fail "not implemented"
end

#perform_async(batch) ⇒ Object



39
40
41
# File 'lib/lowkiq/worker.rb', line 39

def perform_async(batch)
  client_queue.push batch
end

#retry_in(retry_count) ⇒ Object

i.e. 15, 16, 31, 96, 271, … seconds + a random amount of time



19
20
21
# File 'lib/lowkiq/worker.rb', line 19

def retry_in(retry_count)
  (retry_count ** 4) + 15 + (rand(30) * (retry_count + 1))
end