Skip to content

Commit

Permalink
rubocop fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
terrywbrady committed Jan 12, 2024
1 parent 12c6855 commit 166930c
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
6 changes: 3 additions & 3 deletions app/controllers/file_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def check_download
return if current_user_can_download?(obj)
rescue StandardError => e
retries += 1
raise(RetryException.new(e)) if retries > RETRY_LIMIT
raise RetryException, e if retries > RETRY_LIMIT

sleep 1
retry
Expand Down Expand Up @@ -86,7 +86,7 @@ def storage_key_do
do_storage_key_do
rescue StandardError => e
retries += 1
raise(RetryException.new(e)) if retries > RETRY_LIMIT
raise RetryException, e if retries > RETRY_LIMIT

sleep 1
retry
Expand Down Expand Up @@ -222,7 +222,7 @@ def load_file
raise ActiveRecord::RecordNotFound if @file.nil?
rescue StandardError => e
retries += 1
raise(RetryException.new(e)) if retries > RETRY_LIMIT
raise RetryException, e if retries > RETRY_LIMIT

sleep 1
retry
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/object_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def load_object
@object = InvObject.where('ark = ?', params_u(:object)).includes(:inv_collections, inv_versions: [:inv_files]).first
rescue StandardError => e
retries += 1
raise(RetryException.new(e)) if retries > RETRY_LIMIT
raise RetryException, e if retries > RETRY_LIMIT

sleep 1
retry
Expand Down Expand Up @@ -105,7 +105,7 @@ def recent
do_recent
rescue StandardError => e
retries += 1
raise(RetryException.new(e)) if retries > RETRY_LIMIT
raise RetryException, e if retries > RETRY_LIMIT

sleep 1
retry
Expand Down
10 changes: 5 additions & 5 deletions app/models/inv_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def dua_exists?
!inv_duas.blank?
rescue StandardError => e
retries += 1
raise(RetryException.new(e)) if retries > RETRY_LIMIT
raise RetryException, e if retries > RETRY_LIMIT

sleep 1
retry
Expand Down Expand Up @@ -96,7 +96,7 @@ def current_version
# :nocov:
rescue StandardError => e
retries += 1
raise(RetryException.new(e)) if retries > RETRY_LIMIT
raise RetryException, e if retries > RETRY_LIMIT

sleep 1
retry
Expand All @@ -111,7 +111,7 @@ def inv_collection
# :nocov:
rescue StandardError => e
retries += 1
raise(RetryException.new(e)) if retries > RETRY_LIMIT
raise RetryException, e if retries > RETRY_LIMIT

sleep 1
retry
Expand All @@ -134,7 +134,7 @@ def all_local_ids
# :nocov:
rescue StandardError => e
retries += 1
raise(RetryException.new(e)) if retries > RETRY_LIMIT
raise RetryException, e if retries > RETRY_LIMIT

sleep 1
retry
Expand Down Expand Up @@ -226,7 +226,7 @@ def object_info_add_versions(json, maxfile)
# :nocov:
rescue StandardError => e
retries += 1
raise(RetryException.new(e)) if retries > RETRY_LIMIT
raise RetryException, e if retries > RETRY_LIMIT

sleep 1
retry
Expand Down
10 changes: 5 additions & 5 deletions app/models/inv_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def total_size
# :nocov:
rescue StandardError => e
retries += 1
raise(RetryException.new(e)) if retries > RETRY_LIMIT
raise RetryException, e if retries > RETRY_LIMIT

sleep 1
retry
Expand All @@ -43,7 +43,7 @@ def system_files
# :nocov:
rescue StandardError => e
retries += 1
raise(RetryException.new(e)) if retries > RETRY_LIMIT
raise RetryException, e if retries > RETRY_LIMIT

sleep 1
retry
Expand All @@ -58,7 +58,7 @@ def producer_files
# :nocov:
rescue StandardError => e
retries += 1
raise(RetryException.new(e)) if retries > RETRY_LIMIT
raise RetryException, e if retries > RETRY_LIMIT

sleep 1
retry
Expand All @@ -73,7 +73,7 @@ def metadata(element)
# :nocov:
rescue StandardError => e
retries += 1
raise(RetryException.new(e)) if retries > RETRY_LIMIT
raise RetryException, e if retries > RETRY_LIMIT

sleep 1
retry
Expand Down Expand Up @@ -107,7 +107,7 @@ def total_actual_size
inv_files.sum('full_size')
rescue StandardError => e
retries += 1
raise(RetryException.new(e)) if retries > RETRY_LIMIT
raise RetryException, e if retries > RETRY_LIMIT

sleep 1
retry
Expand Down
16 changes: 8 additions & 8 deletions spec/controllers/file_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ def my_presign_wrapper
.with(any_args)
.and_raise(Mysql2::Error::ConnectionError.new('Simulate Failure'))

expect{
expect do
get(:presign, params: params)
}.to raise_error(RetryException)
end.to raise_error(RetryException)
end

it 'redirects to presign url for the file - retry failure on object retreival' do
Expand All @@ -178,9 +178,9 @@ def my_presign_wrapper
.with(any_args)
.and_raise(Mysql2::Error::ConnectionError.new('Simulate Failure'))

expect{
expect do
get(:presign, params: params)
}.to raise_error(RetryException)
end.to raise_error(RetryException)
end

it 'redirects to presign url for the file - retry version check' do
Expand All @@ -192,9 +192,9 @@ def my_presign_wrapper
.with(any_args)
.and_raise(Mysql2::Error::ConnectionError.new('Simulate Failure'))

expect{
expect do
get(:presign, params: params)
}.to raise_error(RetryException)
end.to raise_error(RetryException)
end

it 'redirects to presign url for the file - retry dua check' do
Expand All @@ -206,9 +206,9 @@ def my_presign_wrapper
.with(any_args)
.and_raise(Mysql2::Error::ConnectionError.new('Simulate Failure'))

expect{
expect do
get(:presign, params: params)
}.to raise_error(RetryException)
end.to raise_error(RetryException)
end

it 'test ark encoding recovery' do
Expand Down
8 changes: 4 additions & 4 deletions spec/controllers/object_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@
.with(any_args)
.and_raise(Mysql2::Error::ConnectionError.new('Simulate Failure'))

expect{
expect do
get(:index, params: { object: object_ark })
}.to raise_error(RetryException)
end.to raise_error(RetryException)
end

end
Expand Down Expand Up @@ -772,9 +772,9 @@
.with(any_args)
.and_raise(Mysql2::Error::ConnectionError.new('Simulate Failure'))

expect{
expect do
get(:recent, params: { collection: collection.ark })
}.to raise_error(RetryException)
end.to raise_error(RetryException)
end

it 'gets the list of objects - no collection permissions' do
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/version_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
.with(any_args)
.and_raise(Mysql2::Error::ConnectionError.new('Simulate Failure'))

expect{
expect do
get(:download, params: params)
}.to raise_error(RetryException)
end.to raise_error(RetryException)
end

it 'prevents download when download size exceeded' do
Expand Down

0 comments on commit 166930c

Please sign in to comment.