mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-08 23:15:24 +02:00
Handle no provider
This commit is contained in:
parent
75e624cfbe
commit
bb400e2cd9
2 changed files with 6 additions and 2 deletions
|
@ -2,6 +2,6 @@ class SecurityHealthCheckJob < ApplicationJob
|
|||
queue_as :scheduled
|
||||
|
||||
def perform
|
||||
Security::HealthChecker.new.perform
|
||||
Security::HealthChecker.check_all
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,7 +23,7 @@ class Security::HealthChecker
|
|||
end
|
||||
|
||||
# Daily limit for checked securities
|
||||
due_for_check_scope.limit(DAILY_BATCH_SIZE).find_each do |security|
|
||||
due_for_check_scope.limit(DAILY_BATCH_SIZE).each do |security|
|
||||
new(security).run_check
|
||||
end
|
||||
end
|
||||
|
@ -48,6 +48,8 @@ class Security::HealthChecker
|
|||
end
|
||||
|
||||
def run_check
|
||||
Rails.logger.info("Running health check for #{security.ticker}")
|
||||
|
||||
if latest_provider_price
|
||||
handle_success
|
||||
else
|
||||
|
@ -69,6 +71,8 @@ class Security::HealthChecker
|
|||
end
|
||||
|
||||
def latest_provider_price
|
||||
return nil unless provider.present?
|
||||
|
||||
response = provider.fetch_security_price(
|
||||
symbol: security.ticker,
|
||||
exchange_operating_mic: security.exchange_operating_mic,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue