1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-09 15:35:22 +02:00

Handle no provider

This commit is contained in:
Zach Gollwitzer 2025-05-22 12:13:07 -04:00
parent 75e624cfbe
commit bb400e2cd9
2 changed files with 6 additions and 2 deletions

View file

@ -2,6 +2,6 @@ class SecurityHealthCheckJob < ApplicationJob
queue_as :scheduled
def perform
Security::HealthChecker.new.perform
Security::HealthChecker.check_all
end
end

View file

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