diff --git a/examples/fibers/active_record.ru b/examples/fibers/active_record.ru index 6b0363b..1d798da 100644 --- a/examples/fibers/active_record.ru +++ b/examples/fibers/active_record.ru @@ -5,7 +5,7 @@ Bundler.setup(:default, :example) require 'cramp' require 'active_record' -ActiveRecord::Base.establish_connection(:adapter => "em_mysql2", :username => 'root', :database => "arel_development") +ActiveRecord::Base.establish_connection(:adapter => "em_mysql2", :username => 'root', :database => "arel_development", :pool => 100) class User < ActiveRecord::Base validates_presence_of :name diff --git a/examples/fibers/long_ar_query.ru b/examples/fibers/long_ar_query.ru index a307190..6316712 100644 --- a/examples/fibers/long_ar_query.ru +++ b/examples/fibers/long_ar_query.ru @@ -12,7 +12,10 @@ class User < ActiveRecord::Base end class LongQueryController < Cramp::Action - use_fiber_pool + use_fiber_pool do |pool| + # Called everytime after a fiber is done a callback + pool.generic_callbacks << proc { ActiveRecord::Base.clear_active_connections! } + end on_start :run_srsly_long_query