File tree Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 3535 end
3636 ` ` `
3737
38+ - Pick up config.cron.default_timezone from Rails config ([# 2213](https://github.com/getsentry/sentry-ruby/pull/2213))
39+
3840# # 5.15.2
3941
4042# ## Bug Fixes
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ class Railtie < ::Rails::Railtie
4040
4141 configure_project_root
4242 configure_trusted_proxies
43+ configure_cron_timezone
4344 extend_controller_methods if defined? ( ActionController )
4445 patch_background_worker if defined? ( ActiveRecord )
4546 override_streaming_reporter if defined? ( ActionView )
@@ -70,6 +71,11 @@ def configure_trusted_proxies
7071 Sentry . configuration . trusted_proxies += Array ( ::Rails . application . config . action_dispatch . trusted_proxies )
7172 end
7273
74+ def configure_cron_timezone
75+ tz_info = ::ActiveSupport ::TimeZone . find_tzinfo ( ::Rails . application . config . time_zone )
76+ Sentry . configuration . cron . default_timezone = tz_info . name
77+ end
78+
7379 def extend_controller_methods
7480 require "sentry/rails/controller_methods"
7581 require "sentry/rails/controller_transaction"
Original file line number Diff line number Diff line change 2626 expect ( app . middleware . find_index ( Sentry ::Rails ::RescuedExceptionInterceptor ) ) . to eq ( index_of_debug_exceptions + 1 )
2727 end
2828
29+ it "propagates timezone to cron config" do
30+ # cron.default_timezone is set to nil by default
31+ expect ( Sentry . configuration . cron . default_timezone ) . to eq ( "Etc/UTC" )
32+ end
33+
2934 it "inserts a callback to disable background_worker for the runner mode" do
3035 Sentry . configuration . background_worker_threads = 10
3136
You can’t perform that action at this time.
0 commit comments