In a single line: there will be no change until we change Congress.
A long piece by Lawrence Lessig on how Congress has brought itself to a standstill because of its addiction to campaign money.
A long piece by Lawrence Lessig on how Congress has brought itself to a standstill because of its addiction to campaign money.
I’m working on a little Sinatra project that uses ActiveRecord to access a MySQL database. Funny thing, every fifth request or so would take a long time. I’d just as well sit there and wait; but you wouldn’t, so I figured it out.
Son of a bitch, ActiveRecord’s connection pool. In a Rails app, ActionPack’s request handling life cycle calls ActiveRecord::Base.clear_active_connections! to return connections to the pool. Not so in Sinatra.
Sinatra has before filters but not after filters, so it’ll have to be a Rack solution. So simple, it isn’t even worth a gem. I stuck this at the top of my Sinatra app:
class Crack
def initialize(app)
@app = app
end
def call(env)
response = @app.call(env)
ActiveRecord::Base.clear_active_connections!
response
end
end
use Crack
Friend me on Flickr to see the whole set.
Clear reception in Northern Virginia. Finally.
Don’t know this band from Adam, but I love this venue. I wish all bands posted video of their basement jams.