Skip to content

Commit

Permalink
Set GraphQL cache regardless of bootsnap
Browse files Browse the repository at this point in the history
The cache has nothing to do with bootsnap, so we don't need to piggyback
off of it at all. This will prevent bootsnap cache to be polluted by the
graphql gem, and allow more apps to leverage GQL caching.
  • Loading branch information
gmcgibbon committed Sep 22, 2023
1 parent f6da30f commit a42c474
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions lib/graphql/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
module GraphQL
class Railtie < Rails::Railtie
config.before_configuration do
# Bootsnap compile cache has similar expiration properties,
# so we assume that if the user has bootsnap setup it's ok
# to piggy back on it.
if ::Object.const_defined?("Bootsnap::CompileCache::ISeq") && Bootsnap::CompileCache::ISeq.cache_dir
Language::Parser.cache ||= Language::Cache.new(Pathname.new(Bootsnap::CompileCache::ISeq.cache_dir).join('graphql'))
end
Language::Parser.cache ||= Language::Cache.new(Rails.root.join("tmp/graphql"))
end
end
end

0 comments on commit a42c474

Please sign in to comment.