Method: OceanDynamo::Tables::ClassMethods#wait_until_table_is_active

Defined in:
lib/ocean-dynamo/tables.rb

#wait_until_table_is_activeObject



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/ocean-dynamo/tables.rb', line 77

def wait_until_table_is_active
  loop do
    case dynamo_table.table_status
    when "ACTIVE"
      update_table_if_required
      return
    when "UPDATING", "CREATING"
      sleep 1
      next
    when "DELETING"
      sleep 1 while table_exists?(dynamo_table)
      create_table
      return
    else
      raise UnknownTableStatus.new("Unknown DynamoDB table status '#{dynamo_table.table_status}'")
    end
  end
end