Displaying 2 results from an estimated 2 matches for "find_in_state".
2006 Mar 11
0
Using :joins - How to help Rails populate a list of records from a complex join
Hi,
Due to some performance issues, I want to use a custom query for a find method:
def find_in_state(state)
State.find :all,
:limit => 10,
:conditions => [''s.id = ? AND '' +
''s.id = c.state_id AND c.state_id = ? AND '' +
''c.id = col.county_id AND '...
2008 Mar 18
1
Polling is REALLY slow
...thread_pool.defer(args) do |args|
request = Request.find(args.to_i)
request.build_matches
end
end
def poll_queue
Thread.new do
while @running do
sleep_time = QUEUE_SLEEP_TIME
request = nil
Request.transaction do
request = Request.find_in_state(:first, :queued, :order => ''
requests.updated_at ASC'', :lock => true)
request.search! unless request.nil? # make sure I don''t hit again
end
if request
self.build_matches(request.id)
sleep_time = 0
request = ni...