basic use of sidekiq
Posted 冰凌花花~
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了basic use of sidekiq 相关的知识,希望对你有一定的参考价值。
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
执行
(1)方法1 bundle exec sidekiq 打开页面当前项目下启动http://localhost:3000/sidekiq (2) 方法2 $ 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.
以上是关于basic use of sidekiq 的主要内容,如果未能解决你的问题,请参考以下文章
[Vue + TS] Use Dependency Injection in Vue Using @Inject and @Provide Decorators with TypeScript(代码片
Tracing SQL Queries in Real Time for MySQL Databases using WinDbg and Basic Assembler Knowledge(示例代码
ueditor禁用编辑的时候报错:Uncaught TypeError: Cannot read property 'contentEditable' of undefined(代码片
java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors(代码片
错误处理:one of the variables needed for gradient computation has been modified by inplace operation(代码片
[Algorithm] A nonrecursive algorithm for enumerating all permutations of the numbers {1,2,...,n}(代码片