Skip to content

Commit

Permalink
Merge pull request #152 from CDLUC3/retry4
Browse files Browse the repository at this point in the history
retry4 for inv_object to block mysql2
  • Loading branch information
terrywbrady authored Oct 2, 2023
2 parents 7f870bd + c7fa9e2 commit 380adad
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions app/models/inv_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,14 @@ def bytestream_uri3

# :nocov:
def dua_exists?
!inv_duas.blank?
retries = 0
begin
!inv_duas.blank?
rescue StandardError => e
retries += 1
retries > RETRY_LIMIT ? raise(e) : retry
end
end

# :nocov:

# :nocov:
Expand All @@ -82,11 +87,27 @@ def total_actual_size
end

def current_version
@current_version ||= inv_versions.order('number desc').first
retries = 0
begin
@current_version ||= inv_versions.order('number desc').first
# :nocov:
rescue StandardError => e
retries += 1
retries > RETRY_LIMIT ? raise(e) : retry
end
# :nocov:
end

def inv_collection
@inv_collection ||= inv_collections.first
retries = 0
begin
@inv_collection ||= inv_collections.first
# :nocov:
rescue StandardError => e
retries += 1
retries > RETRY_LIMIT ? raise(e) : retry
end
# :nocov:
end

def group
Expand Down

0 comments on commit 380adad

Please sign in to comment.