mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-27 17:19:39 +02:00
Remove retry logic from security upsert
This commit is contained in:
parent
f07c41821e
commit
5d798fe0a0
1 changed files with 1 additions and 14 deletions
|
@ -64,20 +64,7 @@ module Security::Provided
|
||||||
end
|
end
|
||||||
|
|
||||||
valid_prices.each_slice(100) do |batch|
|
valid_prices.each_slice(100) do |batch|
|
||||||
retries ||= 0
|
Security::Price.upsert_all(batch, unique_by: %i[security_id date currency])
|
||||||
|
|
||||||
begin
|
|
||||||
Security::Price.upsert_all(batch, unique_by: %i[security_id date currency])
|
|
||||||
rescue => e
|
|
||||||
if retries < 3
|
|
||||||
retries += 1
|
|
||||||
sleep(1)
|
|
||||||
Rails.logger.warn("Retrying upsert of #{batch.size} prices for security_id=#{id} ticker=#{ticker} retry=#{retries} error=#{e.message}")
|
|
||||||
retry
|
|
||||||
else
|
|
||||||
raise e
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue