Skip to content

Commit

Permalink
Automatically eager load TZInfo
Browse files Browse the repository at this point in the history
On the first call it can be a bit slow because it needs to load
a bunch of data. It's also better to do it as part of boot
so that some of that data is shared via Copy-on-Write
  • Loading branch information
byroot committed Nov 9, 2023
1 parent 79cf77d commit 7ae4a5f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Expand Up @@ -92,7 +92,7 @@ PATH
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
tzinfo (~> 2.0, >= 2.0.5)
rails (7.2.0.alpha)
actioncable (= 7.2.0.alpha)
actionmailbox (= 7.2.0.alpha)
Expand Down
2 changes: 1 addition & 1 deletion activesupport/activesupport.gemspec
Expand Up @@ -35,7 +35,7 @@ Gem::Specification.new do |s|
# https://edgeguides.rubyonrails.org/security.html#dependency-management-and-cves

s.add_dependency "i18n", ">= 1.6", "< 2"
s.add_dependency "tzinfo", "~> 2.0"
s.add_dependency "tzinfo", "~> 2.0", ">= 2.0.5"
s.add_dependency "concurrent-ruby", "~> 1.0", ">= 1.0.2"
s.add_dependency "connection_pool", ">= 2.2.5"
s.add_dependency "minitest", ">= 5.1"
Expand Down
1 change: 1 addition & 0 deletions activesupport/lib/active_support/railtie.rb
Expand Up @@ -93,6 +93,7 @@ class Railtie < Rails::Railtie # :nodoc:
end
require "active_support/core_ext/time/zones"
Time.zone_default = Time.find_zone!(app.config.time_zone)
config.eager_load_namespaces << TZInfo
end

# Sets the default week start
Expand Down

0 comments on commit 7ae4a5f

Please sign in to comment.