Skip to content

Commit

Permalink
remove calls to eager_load!
Browse files Browse the repository at this point in the history
  • Loading branch information
ethowitz committed Jan 22, 2024
1 parent 2cc6949 commit 380622c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
26 changes: 0 additions & 26 deletions lib/tasks/readyset.rake
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ require 'terminal-table'
namespace :readyset do
desc 'Creates a cache from the given query ID'
task :create_cache, [:id] => :environment do |_, args|
Rails.application.eager_load!

if args.first
Readyset.create_cache!(id: args.first)
else
Expand All @@ -18,8 +16,6 @@ namespace :readyset do
desc 'Creates a cache from the given query ID whose queries will never fall back to the ' \
'primary database'
task :create_cache_always, [:id] => :environment do |_, args|
Rails.application.eager_load!

if args.first
Readyset.create_cache!(id: args.first, always: true)
else
Expand All @@ -29,8 +25,6 @@ namespace :readyset do

desc 'Prints a list of all the queries that ReadySet has proxied'
task proxied_queries: :environment do
Rails.application.eager_load!

rows = Readyset::Query::ProxiedQuery.all.map do |q|
[q.id, q.text, q.supported, q.count]
end
Expand All @@ -42,22 +36,16 @@ namespace :readyset do
namespace :proxied_queries do
desc 'Creates caches for all of the supported queries on ReadySet'
task cache_all_supported: :environment do
Rails.application.eager_load!

Readyset::Query::ProxiedQuery.cache_all_supported!
end

desc 'Clears the list of proxied queries on ReadySet'
task drop_all: :environment do
Rails.application.eager_load!

Readyset.raw_query('DROP ALL PROXIED QUERIES')
end

desc 'Prints a list of all the queries that ReadySet has proxied that can be cached'
task supported: :environment do
Rails.application.eager_load!

rows = Readyset::Query::ProxiedQuery.all.
select { |query| query.supported == :yes }.
map { |q| [q.id, q.text, q.count] }
Expand All @@ -69,8 +57,6 @@ namespace :readyset do

desc 'Prints a list of all the cached queries on ReadySet'
task caches: :environment do
Rails.application.eager_load!

rows = Readyset::Query::CachedQuery.all.map do |q|
[q.id, q.name, q.text, q.always, q.count]
end
Expand All @@ -82,8 +68,6 @@ namespace :readyset do
namespace :caches do
desc 'Drops the cache with the given name'
task :drop, [:name] => :environment do |_, args|
Rails.application.eager_load!

if args.first
Readyset.drop_cache!(args.first)
else
Expand All @@ -93,15 +77,11 @@ namespace :readyset do

desc 'Drops all the caches on ReadySet'
task drop_all: :environment do
Rails.application.eager_load!

Readyset::Query::CachedQuery.drop_all!
end

desc 'Dumps the set of caches that currently exist on ReadySet to a file'
task dump: :environment do
Rails.application.eager_load!

template = File.read(File.join(File.dirname(__FILE__), '../templates/caches.rb.tt'))

queries = Readyset::Query::CachedQuery.all
Expand All @@ -114,8 +94,6 @@ namespace :readyset do
desc 'Synchronizes the caches on ReadySet such that the caches on ReadySet match those ' \
'listed in db/readyset_caches.rb'
task migrate: :environment do
Rails.application.eager_load!

file = Readyset.configuration.migration_path

# We load the definition of the `Readyset::Caches` subclass in the context of a
Expand Down Expand Up @@ -166,8 +144,6 @@ namespace :readyset do

desc 'Prints status information about ReadySet'
task status: :environment do
Rails.application.eager_load!

rows = Readyset.raw_query('SHOW READYSET STATUS').
map { |result| [result['name'], result['value']] }
table = Terminal::Table.new(rows: rows)
Expand All @@ -177,8 +153,6 @@ namespace :readyset do

desc 'Prints information about the tables known to ReadySet'
task tables: :environment do
Rails.application.eager_load!

rows = Readyset.raw_query('SHOW READYSET TABLES').
map { |result| [result['table'], result['status'], result['description']] }
table = Terminal::Table.new(headings: [:table, :status, :description], rows: rows)
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
require_relative 'shared_examples'

Combustion.initialize! :action_controller, :active_record, database_reset: false do
config.eager_load = true
# config.eager_load = true
end

require 'readyset'
Expand Down

0 comments on commit 380622c

Please sign in to comment.