2014-04-29 2 views
0

유니콘과 함께 Heroku에서 4 레일 앱을 실행 중입니다. 240파일을 다운로드 할 때 heroku unicorn timeout이 작동하지 않습니다.

이 나는 ​​경우 작동하지 않습니다

제한 시간 :

는이 응용 프로그램은 그것에게 충분한 시간을 제공하기 위해 상당히 큰 XLS 파일을

을 생성, 내가 설정/unicorn.rb를 통해 제한 시간을 증가 xls 파일을 생성하는 페이지를 실행하면 3001ms 후에 시간 초과가 발생합니다.

왜?

2014-04-29T13:43:27.323190+00:00 app[web.1]: I, [2014-04-29T13:43:27.323084 #8] INFO -- : Started GET "/live_sales.xls?action=index&controller=live_sales" for 81.244.45.218 at 2014-04-29 13:43:27 +0000 
2014-04-29T13:43:27.340252+00:00 app[web.1]: D, [2014-04-29T13:43:27.340190 #8] DEBUG -- : logged in? true 
2014-04-29T13:43:27.339294+00:00 app[web.1]: I, [2014-04-29T13:43:27.339181 #8] INFO -- : Processing by LiveSalesController#index as XLS 
2014-04-29T13:43:27.345465+00:00 app[web.1]: D, [2014-04-29T13:43:27.345383 #8] DEBUG -- : ItemRef Load (3.1ms) SELECT gamme FROM "item_refs" WHERE (gamme is not null and gamme <> '') GROUP BY gamme 
2014-04-29T13:43:28.577687+00:00 app[web.1]: D, [2014-04-29T13:43:28.577526 #8] DEBUG -- : LiveSale Load (1210.0ms) SELECT invoice_date, item_refs.item_brand, item_refs.item_label, item_refs.gamme, item_refs.sub_gamme, item_refs.id, item_refs.item_reference, item_refs.date_published, item_refs.date_unpublished, item_refs.price_purchase, item_refs.current_stock, item_refs.item_published, 
2014-04-29T13:43:28.577694+00:00 app[web.1]: sum(price_purchase * current_stock) as stock_value,sum(quantity) as quantity, 
2014-04-29T13:43:28.577697+00:00 app[web.1]: sum(price_purchase * quantity) as total_purchase FROM "live_sales" left join item_refs on item_refs.id = live_sales.item_ref_id and item_refs.item_published is true and item_refs.disabled is false WHERE ((invoice_date between '2014-03-29 13:43:27 +0000' and '2014-04-29 13:43:27 +0000')) GROUP BY invoice_date, item_refs.item_brand, item_refs.item_label, item_refs.gamme, item_refs.sub_gamme, item_refs.id, item_refs.item_reference, item_refs.date_published, item_refs.date_unpublished, item_refs.price_purchase, item_refs.current_stock, item_refs.item_published ORDER BY invoice_date asc, 
2014-04-29T13:43:57.331088+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path=/live_sales.xls?action=index&controller=live_sales host=azzanalytics.herokuapp.com request_id=6e67b74e-3db8-4853-b5c6-c1f884eaa31e fwd="81.244.45.218" dyno=web.1 connect=1ms service=30001ms status=503 bytes=0 

감사 :

이 내 로그입니다!

답변

0

제안 : 배경 프로세스를 사용하십시오!

주위가 없습니다! 리소스를 확보하기 때문에 가능한 한 빨리 클라이언트에 반환하는 것이 웹 응용 프로그램의 모범 사례입니다. heroku에서 실행중인 dyno가 하나 뿐이고 요청이 여러 개인 경우 제한 시간 동안 차단되어 사용자가 귀하의 페이지에 액세스 할 수 없습니다. 그렇게 오래 걸리는 프로세스가있을 때 쉽게 서비스 거부 사례를 가질 수 있습니다. https://github.com/phoet/freemium 또는 delayed_job

: Heroku가 당신이, 당신이 때문에 비용의 백그라운드 프로세스를 수행하지 않을 경우 씬 서버

에 재정의 프리미엄 (Freemium)를 보라에 관계없이 30초에서 시간 초과