From 0006b6f6ca7cc1f0a56ee6d551f72419a104c941 Mon Sep 17 00:00:00 2001 From: Zach Gollwitzer Date: Fri, 9 May 2025 16:59:23 -0400 Subject: [PATCH] Add env to toggle provider price syncs --- app/models/security/provided.rb | 2 ++ test/test_helper.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/models/security/provided.rb b/app/models/security/provided.rb index b342c9e5..e230b82f 100644 --- a/app/models/security/provided.rb +++ b/app/models/security/provided.rb @@ -29,6 +29,8 @@ module Security::Provided end def sync_provider_prices(start_date:, end_date: Date.current) + return 0 unless ENV["PROVIDER_PRICE_SYNC_ENABLED"] == "true" + unless has_prices? Rails.logger.warn("Security id=#{id} ticker=#{ticker} is not known by provider, skipping price sync") return 0 diff --git a/test/test_helper.rb b/test/test_helper.rb index 23f98faa..b586da49 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -13,6 +13,8 @@ ENV["RAILS_ENV"] ||= "test" # https://github.com/ged/ruby-pg/issues/538#issuecomment-1591629049 ENV["PGGSSENCMODE"] = "disable" +ENV["PROVIDER_PRICE_SYNC_ENABLED"] = "true" + require "rails/test_help" require "minitest/mock" require "minitest/autorun"