Enhance race condition workaround in report_host
parent
c2af36f405
commit
a683cedcce
|
@ -258,9 +258,9 @@ module Msf::DBManager::Host
|
|||
msf_import_timestamps(opts, host)
|
||||
host.save!
|
||||
end
|
||||
rescue ActiveRecord::RecordNotUnique
|
||||
# two concurrent report requests for a new host could result in a RecordNotUnique exception
|
||||
# simply retry the report once more as an optimistic approach
|
||||
rescue ActiveRecord::RecordNotUnique, ActiveRecord::RecordInvalid
|
||||
# two concurrent report requests for a new host could result in a RecordNotUnique or
|
||||
# RecordInvalid exception, simply retry the report once more as an optimistic approach
|
||||
retry if (retry_attempts+=1) <= 1
|
||||
raise
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue