basic use of sidekiq (2)

 

 

此处接上一条博客

vim Gemfile
source "https://rubygems.org"

gem "sidekiq"gem 'rack-protection'
gem "sinatra"

 

vim config.ru
require 'sidekiq'
require 'rack-protection'
Sidekiq.configure_client do |config| config.redis = { db: 1 } end require 'sidekiq/web' run Sidekiq::Web

执行

$ rackup

打开管理页面就可以看到了所有的任务了

http://localhost:9292/

 

可以在sidekiq启动的时候存入任务进程号

$bundle exec sidekiq -r ./worker.rb -P ~/tmp/sidekiq.pid
$cat ~/tmp/sidekiq.pid
1198
$ ps -ax | grep sidekiq
 1198 pts/28   Sl+    0:00 sidekiq 4.1.1  [0 of 25 busy]                                                             
 1259 pts/33   S+     0:00 grep --color=auto sidekiq

 

可以使用sidekiqctl关闭服务

$ sidekiqctl --help
sidekiqctl - stop a Sidekiq process from the command line.

Usage: sidekiqctl <command> <pidfile> <kill_timeout>
 where <command> is either 'quiet' or 'stop'
       <pidfile> is path to a pidfile
       <kill_timeout> is number of seconds to wait until Sidekiq exits
       (default: 10), after which Sidekiq will be KILL'd

Be sure to set the kill_timeout LONGER than Sidekiq's -t timeout.  If you want
to wait 60 seconds for jobs to finish, use `sidekiq -t 60` and `sidekiqctl stop
 path_to_pidfile 61`
$ sidekiqctl stop ~/tmp/sidekiq.pid 
Sidekiq shut down gracefully.

 

转载于:https://www.cnblogs.com/iwangzheng/p/5342006.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值