refactor(virus_scan): remove lock
This commit is contained in:
parent
6e18090fb3
commit
c4a30084fe
5 changed files with 3 additions and 25 deletions
|
@ -10,7 +10,7 @@ class Champs::PieceJustificativeController < ApplicationController
|
|||
end
|
||||
|
||||
def update
|
||||
if attach_piece_justificative_or_retry
|
||||
if attach_piece_justificative
|
||||
render :show
|
||||
else
|
||||
render json: { errors: @champ.errors.full_messages }, status: 422
|
||||
|
@ -46,10 +46,4 @@ class Champs::PieceJustificativeController < ApplicationController
|
|||
|
||||
save_succeed
|
||||
end
|
||||
|
||||
def attach_piece_justificative_or_retry
|
||||
attach_piece_justificative
|
||||
rescue ActiveRecord::StaleObjectError
|
||||
attach_piece_justificative
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,8 +5,7 @@ module ActiveJob::RetryOnTransientErrors
|
|||
Excon::Error::InternalServerError,
|
||||
Excon::Error::GatewayTimeout,
|
||||
Excon::Error::BadRequest,
|
||||
Excon::Error::Socket,
|
||||
ActiveRecord::StaleObjectError
|
||||
Excon::Error::Socket
|
||||
]
|
||||
|
||||
included do
|
||||
|
|
|
@ -2,6 +2,7 @@ module BlobVirusScannerConcern
|
|||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
self.ignored_columns = [:lock_version]
|
||||
before_create :set_pending
|
||||
end
|
||||
|
||||
|
|
|
@ -36,14 +36,10 @@ class CommentaireService
|
|||
|
||||
def self.save(dossier, params)
|
||||
build_and_save(dossier, params)
|
||||
rescue ActiveRecord::StaleObjectError
|
||||
build_and_save(dossier, params)
|
||||
end
|
||||
|
||||
def self.save!(dossier, params)
|
||||
build_and_save(dossier, params, raise_exception: true)
|
||||
rescue ActiveRecord::StaleObjectError
|
||||
build_and_save(dossier, params, raise_exception: true)
|
||||
end
|
||||
|
||||
def self.build_and_save(dossier, params, raise_exception: false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue