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