Skip to content

Commit c222f35

Browse files
committed
Fix formatting of code with UntilPastTableStatus class use
1 parent 76c5522 commit c222f35

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

lib/dynamoid/adapter_plugin/aws_sdk_v3.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,14 @@ def delete_item(table_name, key, options = {})
356356
# @since 1.0.0
357357
def delete_table(table_name, options = {})
358358
resp = client.delete_table(table_name: table_name)
359-
UntilPastTableStatus.new(client, table_name, :deleting).call if options[:sync] &&
360-
(status = PARSE_TABLE_STATUS.call(resp, :table_description)) &&
361-
status == TABLE_STATUSES[:deleting]
359+
360+
if options[:sync]
361+
status = PARSE_TABLE_STATUS.call(resp, :table_description)
362+
if status == TABLE_STATUSES[:deleting]
363+
UntilPastTableStatus.new(client, table_name, :deleting).call
364+
end
365+
end
366+
362367
table_cache.delete(table_name)
363368
rescue Aws::DynamoDB::Errors::ResourceInUseException => e
364369
Dynamoid.logger.error "Table #{table_name} cannot be deleted as it is in use"

lib/dynamoid/adapter_plugin/aws_sdk_v3/create_table.rb

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,16 @@ def call
6262
end
6363
resp = client.create_table(client_opts)
6464
options[:sync] = true if !options.key?(:sync) && ls_indexes.present? || gs_indexes.present?
65-
UntilPastTableStatus.new(client, table_name, :creating).call if options[:sync] &&
66-
(status = PARSE_TABLE_STATUS.call(resp, :table_description)) &&
67-
status == TABLE_STATUSES[:creating]
65+
66+
if options[:sync]
67+
status = PARSE_TABLE_STATUS.call(resp, :table_description)
68+
if status == TABLE_STATUSES[:creating]
69+
UntilPastTableStatus.new(client, table_name, :creating).call
70+
end
71+
end
72+
6873
# Response to original create_table, which, if options[:sync]
69-
# may have an outdated table_description.table_status of "CREATING"
74+
# may have an outdated table_description.table_status of "CREATING"
7075
resp
7176
end
7277

0 commit comments

Comments
 (0)