简体   繁体   English

Sidekiq 作业未在部署到 heroku 的 Rails 应用程序上排队

[英]Sidekiq jobs not queueing on rails app deployed to heroku

I have a rails app using sidekiq, sidekiq-status, and sidekiq batching:我有一个使用 sidekiq、sidekiq-status 和 sidekiq 批处理的 rails 应用程序:

gem "sidekiq"
gem "sidekiq-status"
# freemium version vs sidekiq pro https://github.com/breamware/sidekiq-batch
gem "sidekiq-batch"
# slim & sinatra for sidekiq monitoring
gem "sinatra", "2.0.0.beta2", require: nil

Locally when I run sidekiq and redis, the jobs process.当我在本地运行 sidekiq 和 redis 时,作业进程。 When deployed to heroku, the jobs are queued but they do not process.当部署到 heroku 时,作业会排队,但不会处理。

I am using the Rediscloud and have the env variable REDIS_PROVIDER set to REDISCLOUD_URL and both REDISCLOUD_URL and REDIS_URL set to the generated url from the Rediscloud addon.我正在使用 Rediscloud,并将环境变量REDIS_PROVIDER设置为REDISCLOUD_URL ,并将REDISCLOUD_URLREDIS_URL设置为从 Rediscloud 插件生成的 url。

Procfile:档案:

high_worker: DB_POOL=$SIDEKIQ_DB_POOL bundle exec sidekiq -c $SIDEKIQ_CONCURRENCY -t 8 -q high
default_worker: DB_POOL=$SIDEKIQ_DB_POOL bundle exec sidekiq -c $SIDEKIQ_CONCURRENCY -t 8 -q default
low_worker: DB_POOL=$SIDEKIQ_DB_POOL bundle exec sidekiq -c $SIDEKIQ_CONCURRENCY -t 8 -q low

When I startup a queue manually on heroku, ie heroku run DB_POOL=10 bundle exec sidekiq -c 10 -t 8 -q low -a {my_app_name} , the queue processes those jobs.当我在 heroku 上手动启动队列时,即heroku run DB_POOL=10 bundle exec sidekiq -c 10 -t 8 -q low -a {my_app_name} ,队列处理这些作业。

What am I missing in my configuration?我的配置中缺少什么?

Your Procfile defines process types, but it doesn't make them run.您的Procfile定义了进程类型,但不会使它们运行。

Each process type can run on zero or more dynos.每种流程类型都可以在零个或多个测功机上运行。 To change the number of dynos for each process type you can use the heroku ps:scale command .要更改每种过程类型的测功机数量,您可以使用heroku ps:scale命令 For example, to scale your low_worker process type to one dyno you can do例如,要将您的low_worker流程类型扩展到一种测功机,您可以这样做

heroku ps:scale low_worker=1

Running dynos cost money and / or consume free dyno hours, so budget accordingly.运行测功机需要花钱和/或消耗免费的测功机时间,因此请相应地进行预算。

Alternatively, you can have your jobsrun at scheduled times via the Heroku Scheduler .或者,您可以通过 Heroku Scheduler 让您的作业在预定时间运行 This is less appropriate for tasks that should run continuously, but it's an option.这不太适合应该连续运行的任务,但它是一个选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM