Permalink
Browse files

Example tweaks

  • Loading branch information...
1 parent 5463f30 commit 22002f13342ee356162a8609adab56a7668ee3e6 @lifo committed Aug 5, 2011
Showing with 5 additions and 2 deletions.
  1. +1 −1 examples/fibers/active_record.ru
  2. +4 −1 examples/fibers/long_ar_query.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
@@ -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

0 comments on commit 22002f1

Please sign in to comment.