Skip to content

Instantly share code, notes, and snippets.

@arturaz
Created April 18, 2012 21:40
Show Gist options
  • Save arturaz/2416786 to your computer and use it in GitHub Desktop.
Save arturaz/2416786 to your computer and use it in GitHub Desktop.
def checkin(conn)
synchronize do
conn.run_callbacks :checkin do
conn.expire
@queue.signal
end
release conn
end
end
private
def release(conn)
thread_id = nil
if @reserved_connections[current_connection_id] == conn
thread_id = current_connection_id
else
thread_id = @reserved_connections.keys.find { |k| # BOOM GOES HERE
@reserved_connections[k] == conn
}
end
@reserved_connections.delete thread_id if thread_id
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment