Class: RulesIO::GirlFridayQueue

Inherits:
GirlFriday::WorkQueue
  • Object
show all
Includes:
Singleton
Defined in:
lib/rulesio/girl_friday_queue.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGirlFridayQueue

Returns a new instance of GirlFridayQueue.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rulesio/girl_friday_queue.rb', line 9

def initialize
  super(:rulesio, {:size => 1}.merge(RulesIO.queue_options)) do |msg|
    retries = 0
    begin
      RulesIO.post_payload_to_token msg[:payload], msg[:token]
    rescue Exception => e
      if (retries += 1) % 6 == 5
        RulesIO.logger.warn "RulesIO having trouble sending events; #{retries} attempts so far."
        RulesIO.logger.warn "#{e.inspect}: #{e.message}"
      end
      sleep [5, retries].max
      retry
    end
    RulesIO.logger.warn "RulesIO resuming service after #{retries} retries." unless retries == 0
  end
end

Class Method Details

.push(*args) ⇒ Object



26
27
28
# File 'lib/rulesio/girl_friday_queue.rb', line 26

def self.push *args
  instance.push *args
end

.statusObject



30
31
32
# File 'lib/rulesio/girl_friday_queue.rb', line 30

def self.status
  instance.status
end