- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
所以在用户注册之后,我做了两件事
1) 发送欢迎邮件2) 将他们的 facebook 个人资料图片更新到我的 s3
if user.save
UpdateAvatarWorker.perform_async(user.id)
UserMailer.welcome_email(user).deliver_later unless user.email.nil?
render json: {
status: 200
}
else
render json: { errors: user.errors.messages, status: 500 }
end
现在在 sidekiq 网络用户界面中,我看到这些作业正在排队但未安排
这是我的配置
config/sidekiq.yml
development:
:concurrency: 5
production:
:concurrency: 10
config/initializers/sidekiq.rb
require 'sidekiq'
require 'sidekiq/web'
if Rails.env.production?
Sidekiq.configure_client do |config|
config.redis = { size: 2 }
end
Sidekiq.configure_server do |config|
config.redis = { size: 10 }
end
end
程序文件
web: bundle exec rails server -p $PORT
worker: bundle exec sidekiq -c 10 -v -t 25 -q default -q mailers
config/initializers/redis.rb
uri = URI.parse(ENV['REDISTOGO_URL']) || "redis://localhost:6379/"
REDIS = Redis.new(url: uri)
我在 heroku redis go 中使用迷你计划,它有 50 个到 redis 的连接
redistogo (redistogo-objective-72231) mini $9/month 创建
└─ 为REDISTOGO
工作人员似乎总是处于崩溃模式
➜ couch_bunny git:(master) heroku ps --app couchbunny
=== run: one-off processes (1)
run.9503 (Standard-1X): up 2018/03/31 17:20:00 +0530 (~ 41m ago): rails console
=== web (Standard-1X): bundle exec rails server -p $PORT (1)
web.1: up 2018/03/31 17:31:03 +0530 (~ 30m ago)
=== worker (Standard-1X): bundle exec sidekiq -c 10 -v -t 25 -q default -q mailers (1)
worker.1: crashed 2018/03/31 17:47:20 +0530 (~ 14m ago)
最佳答案
您通过 Sidekiq.configure_server
手动设置池大小为 10
,并以 10
的并发启动 Sidekiq。在内部,Sidekiq 要求池至少有 concurrency + 2
连接,所以这就是错误的来源。
Mike suggests不要手动设置 size
选项,而是让 Sidekiq 来设置。对于 10
的并发,它会自动将池大小设置为 10 + 5 = 15
。
关于ruby-on-rails - 事情在 sidekiq 中排队但没有在 heroku 中执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49587788/
我想使用 rails 控制台重新启动所有失败的作业。有没有办法做到这一点?我可以使用以下方法获取工作列表: require 'sidekiq/api' Sidekiq::Queue.new("mail
我想使用 Datadog 来监控一些后台作业的队列长度。 基本上我需要知道 Sidekiq 中代表队列的键的名称 ,以便我可以按照此处所述对其进行监控: https://docs.datadoghq.
我将 Sidekiq 与 Rails 一起使用,返回的并发值似乎是错误的。 Sidekiq.options[:concurrency] 返回 10 而不是 3,这是我的 config/sidekiq.
从Rails API中,我发现ActiveJob可以retry_job间隔: my_job_instance.enqueue my_job_instance.enqueue wait: 5.minut
我正在一个作业中进行一些处理,最终执行一个外部 shell 命令。该命令正在执行需要数小时才能完成的脚本。 问题是在我使用 spawn 启动脚本后和 detach如果我使用 kill -15 信号关闭
我有一个使用 Capistrano 部署的 Rails 3 应用程序。我最近添加了 Sidekiq。它在我的开发中运行良好。我同时主持 staging和 preview在同一台服务器上,它的预览无法正
我有一个简单的工作线程正在访问其自己的队列的大小: 需要“sidekiq/api” class TestWorker include Sidekiq::Worker def perform(*
我在我的 Rails 应用程序中使用 sidekiq。默认情况下,任何人都可以通过在 url 后附加“/sidekiq”来访问 Sidekiq。我只想用密码保护/验证 sidekiq 部分。我该怎么做
我正在在线阅读一些教程,这些教程告诉我们将 ActiveJob 与 Sidekiq 结合使用。但我不知道我们为什么要这样做。我看到 Sidekiq 具有 ActiveJob 的所有功能。 此外,在 S
我猴子修补了我的用户类(由设计支持)以像这样使用 ActiveJob: class User ActionMailer::DeliveryJob, :args=>["Devise::Mailer",
我有 sidekiq 作业对多种类型的资源进行处理。但是,对于特定类型的资源,例如:资源 X,我需要确保在任何给定时间只有一个 sidekiq 作业可以处理该特定资源。 例如,如果我有 3 个 sid
在过去的一年里,我对我的一项工作的流程进行了大量更改。诸如从相应模型上的 after_commit 而不是 after_create 触发它,以及清理逻辑和覆盖极端情况 我在我的 Heroku Rub
我看到this在 Sidekiq 官方 wiki 中,ActiveJob 会慢得多。 但它是在 2018 年 3 月根据此 issue 基于 Rails 4.2 和 Sidekiq 5.1.1 提到的
我使用 Rails 4 默认测试框架并编写了一些测试,这些测试也希望 Sidekiq 在“后台”做一些工作。但是当我运行 rake test 时,我的测试结果看起来像这样: .............
我们几周前在我们的系统中添加了监控用户事件,如下所示: class ApplicationController < ActionController::Base before_filter :lo
我正在运行 7 个 sidekiq 进程(货币设置为 40)和一个乘客网络服务器,连接到 postgres 数据库。 Rails 池设置设置为 100,postgres max_connectio
我第一次在 Rails 应用程序中使用 Sidekiq。这也是我第一次使用Redis。 我见过几个示例(Here、here、here),其中 initializers/sidekiq.rb 包含以下几
我刚开始使用 sidekiq 和 redis,我试图让 sidekiq 在 Heroku 上运行,但每次我部署 Rails 4 应用程序时它似乎都会崩溃。我在 Papertrail 中收到此错误: M
我有一个要求,我应该能够每秒运行 100 个 sidekiq 作业。 我将服务器容量增加到 8 个 CPU 并创建了 4 个 sidekiq 进程,但它仍然每分钟服务 50 个作业。 我不确定我在哪里
我在 Sidekiq 中有两种队列:“default/low”——满足网络请求和“background_queue”——运行后台进程,比如获取推文。我想在不同的 dyno 上运行“background
我是一名优秀的程序员,十分优秀!