Enhance race condition workaround in report_host

GSoC/Meterpreter_Web_Console
Matthew Kienow 2018-12-14 12:28:16 -05:00
parent c2af36f405
commit a683cedcce
No known key found for this signature in database
GPG Key ID: 40787F8B1EAC6E41
1 changed files with 3 additions and 3 deletions

View File

@ -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