mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-09 07:25:19 +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
|
queue_as :scheduled
|
||||||
|
|
||||||
def perform
|
def perform
|
||||||
Security::HealthChecker.new.perform
|
Security::HealthChecker.check_all
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Security::HealthChecker
|
||||||
end
|
end
|
||||||
|
|
||||||
# Daily limit for checked securities
|
# 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
|
new(security).run_check
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -48,6 +48,8 @@ class Security::HealthChecker
|
||||||
end
|
end
|
||||||
|
|
||||||
def run_check
|
def run_check
|
||||||
|
Rails.logger.info("Running health check for #{security.ticker}")
|
||||||
|
|
||||||
if latest_provider_price
|
if latest_provider_price
|
||||||
handle_success
|
handle_success
|
||||||
else
|
else
|
||||||
|
@ -69,6 +71,8 @@ class Security::HealthChecker
|
||||||
end
|
end
|
||||||
|
|
||||||
def latest_provider_price
|
def latest_provider_price
|
||||||
|
return nil unless provider.present?
|
||||||
|
|
||||||
response = provider.fetch_security_price(
|
response = provider.fetch_security_price(
|
||||||
symbol: security.ticker,
|
symbol: security.ticker,
|
||||||
exchange_operating_mic: security.exchange_operating_mic,
|
exchange_operating_mic: security.exchange_operating_mic,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue