2016-10-07 4 views
3

지연된 작업을 사용할 때 특정 대기열에 대해 하나의 작업자를 지정하려면 어떻게합니까?지연된 작업의 대기열에 하나의 작업자를 지정하는 방법

# Use the --pool option to specify a worker pool. You can use this option 
# multiple times to start different numbers of workers for different queues. 
# The following command will start 1 worker for the tracking queue, 
# 2 workers for the mailers and tasks queues, and 2 workers for any jobs: 

RAILS_ENV=production script/delayed_job --pool=tracking --pool=mailers,tasks:2 --pool=*:2 start 

그러나 우리에게 Heroku를 사용하고 있기 때문에 우리는 우리의 노동자를 실행하는 procfile을 사용하고 있습니다 :

worker_1: bundle exec rake jobs:work 
worker_2: bundle exec rake jobs:work 
:

worker: bundle exec foreman start -f Procfile.workers 우리 노동자 파일은 작업을 실행 내가이 명령을 실행할 수 있습니다 알고

은 내가 그러나 할 걸려 뭔가 같은 :

bundle exec rake jobs:work --queue=specific_queue 

및 O specific_queue를 작업하는 한 명의 작업자와 다른 대기열에서 작업하는 다른 작업자가 있어야합니다.

어떻게하면됩니까? 당신에게 Heroku의 Process Types and the Procfile 문서를 살펴 경우

+0

내 답변이 도움이 되었습니까? –

답변

2

, 당신은 마지막에 this 예를 찾을 수 있습니다 : 예를 들어

, 다른 큐를 각각 , 당신은 큐 노동자의 두 가지 유형을 실행할 수 루비를 사용하여 소모 :

worker:  env QUEUE=* bundle exec rake resque:work 
urgentworker: env QUEUE=urgent bundle exec rake resque:work 

지연된 작업은 Resque와 비슷한 것을 사용합니다. env 변수 QUEUE 또는 QUEUES를 사용하여 특정 작업자에 대한 대기열을 지정합니다.

lib/delayed/tasks.rbsource code에서 확인할 수 있습니다.

+0

그랬습니다. 고맙습니다 –

관련 문제