Sidekiq 6 仅在我进入 Web 控制台时进行轮询
Sidekiq 6 only does polling when I enter web console
我真的不知道为什么,但我的 sidekiq 似乎在一段时间后停止工作。
但是,如果我
- 打开网络控制台
/sidekiq
- 通过 ssh 和
ps aux | grep sidekiq
登录服务器
一旦我做了以上两件事之一,sidekiq
立即开始投票
我的环境是
- Sidekiq 6.2.1
- Ubuntu20.04
- Rails6.1.3.1
我用systemd
和capistrano-sidekiq来控制sidekiq,谁能帮帮我?
# config/sidekiq.yaml
:queues:
- default
- order-jobs
这是~/.config/systemd/user/sidekiq.service
我写的:
[Unit]
Description=sidekiq
After=syslog.target network.target
[Service]
Type=notify
WatchdogSec=10
WorkingDirectory=/path/to/my/app/current
ExecStart=/home/my_username/.rvm/bin/rvm in /path/to/my/app/current do bundle exec sidekiq -e production
ExecReload=/usr/bin/kill -TSTP $MAINPID
# Greatly reduce Ruby memory fragmentation and heap usage
# https://www.mikeperham.com/2018/04/25/taming-rails-memory-bloat/
Environment=MALLOC_ARENA_MAX=2
# if we crash, restart
RestartSec=1
Restart=on-failure
# output goes to /var/log/syslog
StandardOutput=syslog
StandardError=syslog
# This will default to "bundler" if we don't specify it
SyslogIdentifier=sidekiq
[Install]
WantedBy=default.target
systemd
的用户服务结果证明它们仅在用户登录会话时有效。
一旦最后一个会话结束,该服务将停止。
所以这就是为什么我的 sidekiq
,即用户服务 运行,在我注销后每次都停止。
我们可以简单地使用 loginctl enable-linger username
来创建用户的持续现有会话。
我真的不知道为什么,但我的 sidekiq 似乎在一段时间后停止工作。
但是,如果我
- 打开网络控制台
/sidekiq
- 通过 ssh 和
ps aux | grep sidekiq
登录服务器 一旦我做了以上两件事之一,sidekiq
立即开始投票
我的环境是
- Sidekiq 6.2.1
- Ubuntu20.04
- Rails6.1.3.1
我用systemd
和capistrano-sidekiq来控制sidekiq,谁能帮帮我?
# config/sidekiq.yaml
:queues:
- default
- order-jobs
这是~/.config/systemd/user/sidekiq.service
我写的:
[Unit]
Description=sidekiq
After=syslog.target network.target
[Service]
Type=notify
WatchdogSec=10
WorkingDirectory=/path/to/my/app/current
ExecStart=/home/my_username/.rvm/bin/rvm in /path/to/my/app/current do bundle exec sidekiq -e production
ExecReload=/usr/bin/kill -TSTP $MAINPID
# Greatly reduce Ruby memory fragmentation and heap usage
# https://www.mikeperham.com/2018/04/25/taming-rails-memory-bloat/
Environment=MALLOC_ARENA_MAX=2
# if we crash, restart
RestartSec=1
Restart=on-failure
# output goes to /var/log/syslog
StandardOutput=syslog
StandardError=syslog
# This will default to "bundler" if we don't specify it
SyslogIdentifier=sidekiq
[Install]
WantedBy=default.target
systemd
的用户服务结果证明它们仅在用户登录会话时有效。
一旦最后一个会话结束,该服务将停止。
所以这就是为什么我的 sidekiq
,即用户服务 运行,在我注销后每次都停止。
我们可以简单地使用 loginctl enable-linger username
来创建用户的持续现有会话。