module Shoryuken::Waiter

Constants

DEFAULT_POLL_DELAY
MAX_QUEUE_DELAY
TABLE_PRIMARY_ITEM_KEY_VALUE
VERSION

Public Class Methods

client() click to toggle source
# File lib/shoryuken/waiter.rb, line 15
def client
  @client ||= Aws::DynamoDB::Client.new
end
options() click to toggle source
# File lib/shoryuken/waiter.rb, line 34
def options
  @options ||= Shoryuken.options[:waiter] || {}
end
poll_delay() click to toggle source
# File lib/shoryuken/waiter.rb, line 38
def poll_delay
  options[:delay] || DEFAULT_POLL_DELAY
end
tables() click to toggle source
# File lib/shoryuken/waiter.rb, line 19
def tables
  @tables ||= Shoryuken.queues.uniq.map do |queue_name|
    table = Aws::DynamoDB::Table.new(queue_name, client: client)

    begin
      table.table_arn
      Shoryuken.logger.debug { "[Shoryuken::Waiter] Found wait table for queue '#{queue_name}'" }
      table
    rescue Aws::DynamoDB::Errors::ResourceNotFoundException
      Shoryuken.logger.debug { "[Shoryuken::Waiter] No wait table for queue '#{queue_name}'" }
      nil
    end
  end.compact
end