I'm getting information from the database (MongoDB) and then converting it to an array like that:
@bs = coll.find("headers.from" => { "$regex" => email, "$options" => 'i' }, "date" => {"$gte" => initial_date, "$lte" => Time.now.utc})
puts "a seguir ao fetch"
puts @bs
@bs = @bs.to_a
This works very well but sometimes, it just enters in an infinite cycle (I believe) because It crashes my heroku app.
The response (the first line is the print of @bs):
2011-05-14T17:05:46+00:00 app[web.1]: DBResponse(flags=, cursor_id=, start=)
2011-05-14T17:06:16+00:00 heroku[router]: Error H12 (Request timeout) -> GET yapi.heroku.com/api/v1/69399ead0ed4ded38e7a101f7c8faf/2011-2-1.json dyno=web.1 queue=0 wait=0ms service=0ms bytes=0
2011-05-14T17:06:47+00:00 heroku[router]: Error H12 (Request timeout) -> GET yapi.heroku.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=0ms bytes=0
2011-05-14T17:07:10+00:00 heroku[router]: Error H12 (Request timeout) -> GET yapi.heroku.com/api/v1/69399ead0ed4ded38e7a101f7c8faf/2011-2-1.json dyno=web.1 queue=0 wait=0ms service=0ms bytes=0
2011-05-14T17:07:17+00:00 heroku[router]: Error H12 (Request timeout) -> GET yapi.heroku.com/api/v1/69399ead0ed4ded38e7a101f7c8faf/2011-2-1.json dyno=web.1 queue=0 wait=0ms service=0ms bytes=0
2011-05-14T17:07:51+00:00 heroku[router]: Error H12 (Request timeout) -> GET yapi.heroku.com/api/v1/69399ead0ed4ded38e7a101f7c8faf/2011-2-1.json dyno=web.1 queue=0 wait=0ms service=0ms bytes=0
I'd like to know why because I really can't find out why with all the debug information. IT just holds on the ".to_a" forever and the server is blocked.
Please help.
Thanks