mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
merge master
This commit is contained in:
commit
a67c9b1d90
70 changed files with 166 additions and 36 deletions
|
@ -25,6 +25,9 @@ gem 'redis-namespace'
|
||||||
`concurrency + 2` connections in your pool or Sidekiq will exit.
|
`concurrency + 2` connections in your pool or Sidekiq will exit.
|
||||||
When in doubt, let Sidekiq size the connection pool for you.
|
When in doubt, let Sidekiq size the connection pool for you.
|
||||||
|
|
||||||
|
* Worker data is no longer updated in real-time but rather upon every
|
||||||
|
heartbeat. Don't expect the `Sidekiq::Workers` API to be millisecond-precise.
|
||||||
|
|
||||||
* There's a new testing API based off the `Sidekiq::Queues` namespace. All
|
* There's a new testing API based off the `Sidekiq::Queues` namespace. All
|
||||||
assertions made against the Worker class still work as expected.
|
assertions made against the Worker class still work as expected.
|
||||||
```ruby
|
```ruby
|
||||||
|
|
29
Changes.md
29
Changes.md
|
@ -1,8 +1,37 @@
|
||||||
# Sidekiq Changes
|
# Sidekiq Changes
|
||||||
|
|
||||||
|
HEAD
|
||||||
|
-----------
|
||||||
|
|
||||||
|
- Fixed race condition in heartbeat which could rarely lead to lingering
|
||||||
|
processes on the Busy tab. [#2982]
|
||||||
|
```ruby
|
||||||
|
# to clean up lingering processes, modify this as necessary to connect to your Redis.
|
||||||
|
# after 60 seconds, lingering processes should disappear from the Busy page.
|
||||||
|
|
||||||
|
require 'redis'
|
||||||
|
r = Redis.new(url: "redis://localhost:6379/0")
|
||||||
|
# uncomment if you need a namespace
|
||||||
|
#require 'redis-namespace'
|
||||||
|
#r = Redis::Namespace.new("foo", r)
|
||||||
|
r.smembers("processes").each do |pro|
|
||||||
|
r.expire(pro, 60)
|
||||||
|
r.expire("#{pro}:workers", 60)
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
4.1.2
|
4.1.2
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
- Fix Redis data leak with worker data when a busy Sidekiq process
|
||||||
|
crashes. You can find and expire leaked data in Redis with this
|
||||||
|
script:
|
||||||
|
```bash
|
||||||
|
$ redis-cli keys "*:workers" | while read LINE ; do TTL=`redis-cli expire "$LINE" 60`; echo "$LINE"; done;
|
||||||
|
```
|
||||||
|
Please note that `keys` can be dangerous to run on a large, busy Redis. Caveat runner.
|
||||||
|
- Freeze all string literals with Ruby 2.3. [#2741]
|
||||||
- Client middleware can now stop bulk job push. [#2887]
|
- Client middleware can now stop bulk job push. [#2887]
|
||||||
|
|
||||||
4.1.1
|
4.1.1
|
||||||
|
|
|
@ -3,6 +3,12 @@ Sidekiq Enterprise Changelog
|
||||||
|
|
||||||
Please see [http://sidekiq.org/](http://sidekiq.org/) for more details and how to buy.
|
Please see [http://sidekiq.org/](http://sidekiq.org/) for more details and how to buy.
|
||||||
|
|
||||||
|
HEAD
|
||||||
|
-------------
|
||||||
|
|
||||||
|
- Add API to check if a unique lock is present. See [#2932] for details.
|
||||||
|
- Tune concurrent limiters to minimize thread thrashing under heavy contention. [#2944]
|
||||||
|
|
||||||
1.2.1
|
1.2.1
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
|
5
Gemfile
5
Gemfile
|
@ -1,9 +1,10 @@
|
||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
gemspec
|
gemspec
|
||||||
|
|
||||||
gem 'rails', '5.0.0.beta2'
|
gem 'rails', '5.0.0.rc1'
|
||||||
gem 'rack', '2.0.0.alpha'
|
gem 'rack', '2.0.0.rc1'
|
||||||
gem 'sinatra', github: 'sinatra/sinatra'
|
gem 'sinatra', github: 'sinatra/sinatra'
|
||||||
|
gem "hiredis"
|
||||||
gem 'simplecov'
|
gem 'simplecov'
|
||||||
gem 'minitest'
|
gem 'minitest'
|
||||||
gem 'minitest-utils'
|
gem 'minitest-utils'
|
||||||
|
|
|
@ -17,17 +17,15 @@ Sidekiq Pro 3.0 is designed to work with Sidekiq 4.0.
|
||||||
* Reliable fetch has been re-implemented due to the fetch changes in
|
* Reliable fetch has been re-implemented due to the fetch changes in
|
||||||
Sidekiq 4.0.
|
Sidekiq 4.0.
|
||||||
|
|
||||||
* Support for platforms without persistent hostnames. Since reliable fetch
|
* Support for platforms without persistent hostnames. Since the reliable\_fetch
|
||||||
normally requires a persistent hostname, you may disable hostname usage on
|
algorithm requires a persistent hostname, an alternative reliability
|
||||||
platforms like Heroku and Docker:
|
algorithm is now available for platforms like Heroku and Docker:
|
||||||
```ruby
|
```ruby
|
||||||
Sidekiq.configure_server do |config|
|
Sidekiq.configure_server do |config|
|
||||||
config.options[:ephemeral_hostname] = true
|
config.timed_fetch!
|
||||||
config.reliable_fetch!
|
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
This option is enabled automatically if Heroku's DYNO environment variable is present.
|
The wiki contains [much more detail about each reliability option](https://github.com/mperham/sidekiq/wiki/Pro-Reliability-Server).
|
||||||
Without a persistent hostname, each Sidekiq process **must** have its own unique index.
|
|
||||||
|
|
||||||
* The old 'sidekiq/notifications' features have been removed.
|
* The old 'sidekiq/notifications' features have been removed.
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,20 @@ Sidekiq Pro Changelog
|
||||||
|
|
||||||
Please see [http://sidekiq.org/](http://sidekiq.org/) for more details and how to buy.
|
Please see [http://sidekiq.org/](http://sidekiq.org/) for more details and how to buy.
|
||||||
|
|
||||||
|
HEAD
|
||||||
|
---------
|
||||||
|
|
||||||
|
- Don't permanently delete batches immediately upon success [#3011]
|
||||||
|
- New `Sidekiq::PendingSet#destroy(jid)` API to remove poison pill jobs [#3015]
|
||||||
|
|
||||||
|
3.2.2
|
||||||
|
---------
|
||||||
|
|
||||||
|
- A default value for -i is only set in development now, staging or
|
||||||
|
other environments must set an index if you wish to use reliable\_fetch. [#2971]
|
||||||
|
- Fix nil dereference when checking for jobs over timeout in timed\_fetch
|
||||||
|
|
||||||
|
|
||||||
3.2.1
|
3.2.1
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,8 @@ message format as Resque so it can integrate into an existing Resque processing
|
||||||
You can have Sidekiq and Resque run side-by-side at the same time and
|
You can have Sidekiq and Resque run side-by-side at the same time and
|
||||||
use the Resque client to enqueue jobs in Redis to be processed by Sidekiq.
|
use the Resque client to enqueue jobs in Redis to be processed by Sidekiq.
|
||||||
|
|
||||||
Sidekiq is fast.
|
Performance
|
||||||
|
---------------
|
||||||
|
|
||||||
Version | Latency | Garbage created for 10,000 jobs | Time to process 100,000 jobs | Throughput
|
Version | Latency | Garbage created for 10,000 jobs | Time to process 100,000 jobs | Throughput
|
||||||
-----------------|------|---------|---------|------------------------
|
-----------------|------|---------|---------|------------------------
|
||||||
|
|
|
@ -26,8 +26,8 @@ Toxiproxy.populate([{
|
||||||
|
|
||||||
|
|
||||||
Sidekiq.configure_server do |config|
|
Sidekiq.configure_server do |config|
|
||||||
config.redis = { db: 13, port: 6380 }
|
#config.options[:concurrency] = 1
|
||||||
#config.redis = { db: 13 }
|
config.redis = { driver: :hiredis, db: 13, port: 6380 }
|
||||||
config.options[:queues] << 'default'
|
config.options[:queues] << 'default'
|
||||||
config.logger.level = Logger::ERROR
|
config.logger.level = Logger::ERROR
|
||||||
config.average_scheduled_poll_interval = 2
|
config.average_scheduled_poll_interval = 2
|
||||||
|
|
|
@ -42,6 +42,10 @@ normal exit 0 TERM
|
||||||
# this commented out.
|
# this commented out.
|
||||||
reload signal USR1
|
reload signal USR1
|
||||||
|
|
||||||
|
# Upstart waits 5 seconds by default to kill the a process. Increase timeout to
|
||||||
|
# give sidekiq process enough time to exit.
|
||||||
|
kill timeout 15
|
||||||
|
|
||||||
instance $index
|
instance $index
|
||||||
|
|
||||||
script
|
script
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
require 'sidekiq/version'
|
require 'sidekiq/version'
|
||||||
fail "Sidekiq #{Sidekiq::VERSION} does not support Ruby versions below 2.0.0." if RUBY_PLATFORM != 'java' && RUBY_VERSION < '2.0.0'
|
fail "Sidekiq #{Sidekiq::VERSION} does not support Ruby versions below 2.0.0." if RUBY_PLATFORM != 'java' && RUBY_VERSION < '2.0.0'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
require 'sidekiq'
|
require 'sidekiq'
|
||||||
|
|
||||||
|
@ -195,7 +196,7 @@ module Sidekiq
|
||||||
# Return all known queues within Redis.
|
# Return all known queues within Redis.
|
||||||
#
|
#
|
||||||
def self.all
|
def self.all
|
||||||
Sidekiq.redis {|c| c.smembers('queues'.freeze) }.sort.map {|q| Sidekiq::Queue.new(q) }
|
Sidekiq.redis { |c| c.smembers('queues'.freeze) }.sort.map { |q| Sidekiq::Queue.new(q) }
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_reader :name
|
attr_reader :name
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
$stdout.sync = true
|
$stdout.sync = true
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'securerandom'
|
require 'securerandom'
|
||||||
require 'sidekiq/middleware/chain'
|
require 'sidekiq/middleware/chain'
|
||||||
|
|
||||||
|
@ -83,6 +84,7 @@ module Sidekiq
|
||||||
# than the number given if the middleware stopped processing for one or more jobs.
|
# than the number given if the middleware stopped processing for one or more jobs.
|
||||||
def push_bulk(items)
|
def push_bulk(items)
|
||||||
arg = items['args'].first
|
arg = items['args'].first
|
||||||
|
return [] unless arg # no jobs to push
|
||||||
raise ArgumentError, "Bulk arguments must be an Array of Arrays: [[1], [2]]" if !arg.is_a?(Array)
|
raise ArgumentError, "Bulk arguments must be an Array of Arrays: [[1], [2]]" if !arg.is_a?(Array)
|
||||||
|
|
||||||
normed = normalize_item(items)
|
normed = normalize_item(items)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
begin
|
begin
|
||||||
require 'active_support/core_ext/class/attribute'
|
require 'active_support/core_ext/class/attribute'
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'sidekiq'
|
require 'sidekiq'
|
||||||
|
|
||||||
module Sidekiq
|
module Sidekiq
|
||||||
|
@ -5,7 +6,7 @@ module Sidekiq
|
||||||
|
|
||||||
class Logger
|
class Logger
|
||||||
def call(ex, ctxHash)
|
def call(ex, ctxHash)
|
||||||
Sidekiq.logger.warn(ctxHash) if !ctxHash.empty?
|
Sidekiq.logger.warn(Sidekiq.dump_json(ctxHash)) if !ctxHash.empty?
|
||||||
Sidekiq.logger.warn "#{ex.class.name}: #{ex.message}"
|
Sidekiq.logger.warn "#{ex.class.name}: #{ex.message}"
|
||||||
Sidekiq.logger.warn ex.backtrace.join("\n") unless ex.backtrace.nil?
|
Sidekiq.logger.warn ex.backtrace.join("\n") unless ex.backtrace.nil?
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'sidekiq/extensions/generic_proxy'
|
require 'sidekiq/extensions/generic_proxy'
|
||||||
|
|
||||||
module Sidekiq
|
module Sidekiq
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'sidekiq/extensions/generic_proxy'
|
require 'sidekiq/extensions/generic_proxy'
|
||||||
|
|
||||||
module Sidekiq
|
module Sidekiq
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'sidekiq/extensions/generic_proxy'
|
require 'sidekiq/extensions/generic_proxy'
|
||||||
|
|
||||||
module Sidekiq
|
module Sidekiq
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
|
|
||||||
module Sidekiq
|
module Sidekiq
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'sidekiq'
|
require 'sidekiq'
|
||||||
|
|
||||||
module Sidekiq
|
module Sidekiq
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
require 'sidekiq/manager'
|
require 'sidekiq/manager'
|
||||||
require 'sidekiq/fetch'
|
require 'sidekiq/fetch'
|
||||||
|
@ -79,7 +80,7 @@ module Sidekiq
|
||||||
workers_key = "#{key}:workers".freeze
|
workers_key = "#{key}:workers".freeze
|
||||||
nowdate = Time.now.utc.strftime("%Y-%m-%d".freeze)
|
nowdate = Time.now.utc.strftime("%Y-%m-%d".freeze)
|
||||||
Sidekiq.redis do |conn|
|
Sidekiq.redis do |conn|
|
||||||
conn.pipelined do
|
conn.multi do
|
||||||
conn.incrby("stat:processed".freeze, procd)
|
conn.incrby("stat:processed".freeze, procd)
|
||||||
conn.incrby("stat:processed:#{nowdate}", procd)
|
conn.incrby("stat:processed:#{nowdate}", procd)
|
||||||
conn.incrby("stat:failed".freeze, fails)
|
conn.incrby("stat:failed".freeze, fails)
|
||||||
|
@ -88,12 +89,13 @@ module Sidekiq
|
||||||
Processor::WORKER_STATE.each_pair do |tid, hash|
|
Processor::WORKER_STATE.each_pair do |tid, hash|
|
||||||
conn.hset(workers_key, tid, Sidekiq.dump_json(hash))
|
conn.hset(workers_key, tid, Sidekiq.dump_json(hash))
|
||||||
end
|
end
|
||||||
|
conn.expire(workers_key, 60)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
fails = procd = 0
|
fails = procd = 0
|
||||||
|
|
||||||
_, _, _, msg = Sidekiq.redis do |conn|
|
_, _, _, msg = Sidekiq.redis do |conn|
|
||||||
conn.pipelined do
|
conn.multi do
|
||||||
conn.sadd('processes', key)
|
conn.sadd('processes', key)
|
||||||
conn.hmset(key, 'info', json, 'busy', Processor::WORKER_STATE.size, 'beat', Time.now.to_f, 'quiet', @done)
|
conn.hmset(key, 'info', json, 'busy', Processor::WORKER_STATE.size, 'beat', Time.now.to_f, 'quiet', @done)
|
||||||
conn.expire(key, 60)
|
conn.expire(key, 60)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'time'
|
require 'time'
|
||||||
require 'logger'
|
require 'logger'
|
||||||
require 'fcntl'
|
require 'fcntl'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
require 'sidekiq/util'
|
require 'sidekiq/util'
|
||||||
require 'sidekiq/processor'
|
require 'sidekiq/processor'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
module Sidekiq
|
module Sidekiq
|
||||||
# Middleware is code configured to run before/after
|
# Middleware is code configured to run before/after
|
||||||
# a message is processed. It is patterned after Rack
|
# a message is processed. It is patterned after Rack
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Simple middleware to save the current locale and restore it when the job executes.
|
# Simple middleware to save the current locale and restore it when the job executes.
|
||||||
# Use it by requiring it in your initializer:
|
# Use it by requiring it in your initializer:
|
||||||
|
|
|
@ -8,14 +8,14 @@ module Sidekiq
|
||||||
# Automatically retry jobs that fail in Sidekiq.
|
# Automatically retry jobs that fail in Sidekiq.
|
||||||
# Sidekiq's retry support assumes a typical development lifecycle:
|
# Sidekiq's retry support assumes a typical development lifecycle:
|
||||||
#
|
#
|
||||||
# 0. push some code changes with a bug in it
|
# 0. Push some code changes with a bug in it.
|
||||||
# 1. bug causes job processing to fail, sidekiq's middleware captures
|
# 1. Bug causes job processing to fail, Sidekiq's middleware captures
|
||||||
# the job and pushes it onto a retry queue
|
# the job and pushes it onto a retry queue.
|
||||||
# 2. sidekiq retries jobs in the retry queue multiple times with
|
# 2. Sidekiq retries jobs in the retry queue multiple times with
|
||||||
# an exponential delay, the job continues to fail
|
# an exponential delay, the job continues to fail.
|
||||||
# 3. after a few days, a developer deploys a fix. the job is
|
# 3. After a few days, a developer deploys a fix. The job is
|
||||||
# reprocessed successfully.
|
# reprocessed successfully.
|
||||||
# 4. once retries are exhausted, sidekiq will give up and move the
|
# 4. Once retries are exhausted, Sidekiq will give up and move the
|
||||||
# job to the Dead Job Queue (aka morgue) where it must be dealt with
|
# job to the Dead Job Queue (aka morgue) where it must be dealt with
|
||||||
# manually in the Web UI.
|
# manually in the Web UI.
|
||||||
# 5. After 6 months on the DJQ, Sidekiq will discard the job.
|
# 5. After 6 months on the DJQ, Sidekiq will discard the job.
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
module Sidekiq
|
module Sidekiq
|
||||||
module Paginator
|
module Paginator
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'sidekiq/util'
|
require 'sidekiq/util'
|
||||||
require 'sidekiq/fetch'
|
require 'sidekiq/fetch'
|
||||||
require 'thread'
|
require 'thread'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
module Sidekiq
|
module Sidekiq
|
||||||
def self.hook_rails!
|
def self.hook_rails!
|
||||||
return if defined?(@delay_removed)
|
return if defined?(@delay_removed)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'connection_pool'
|
require 'connection_pool'
|
||||||
require 'redis'
|
require 'redis'
|
||||||
require 'uri'
|
require 'uri'
|
||||||
|
@ -7,6 +8,8 @@ module Sidekiq
|
||||||
class << self
|
class << self
|
||||||
|
|
||||||
def create(options={})
|
def create(options={})
|
||||||
|
options = options.symbolize_keys
|
||||||
|
|
||||||
options[:url] ||= determine_redis_provider
|
options[:url] ||= determine_redis_provider
|
||||||
|
|
||||||
size = options[:size] || (Sidekiq.server? ? (Sidekiq.options[:concurrency] + 5) : 5)
|
size = options[:size] || (Sidekiq.server? ? (Sidekiq.options[:concurrency] + 5) : 5)
|
||||||
|
@ -32,7 +35,7 @@ module Sidekiq
|
||||||
# - enterprise's leader election
|
# - enterprise's leader election
|
||||||
# - enterprise's cron support
|
# - enterprise's cron support
|
||||||
def verify_sizing(size, concurrency)
|
def verify_sizing(size, concurrency)
|
||||||
raise ArgumentError, "Your Redis connection pool is too small for Sidekiq to work, your pool has #{size} connections but really needs to have at least #{concurrency + 2}" if size <= concurrency
|
raise ArgumentError, "Your Redis connection pool is too small for Sidekiq to work. Your pool has #{size} connections but really needs to have at least #{concurrency + 2}" if size <= concurrency
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_client(options)
|
def build_client(options)
|
||||||
|
@ -44,8 +47,8 @@ module Sidekiq
|
||||||
require 'redis/namespace'
|
require 'redis/namespace'
|
||||||
Redis::Namespace.new(namespace, :redis => client)
|
Redis::Namespace.new(namespace, :redis => client)
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
Sidekiq.logger.error("Your Redis configuration use the namespace '#{namespace}' but the redis-namespace gem not included in Gemfile." \
|
Sidekiq.logger.error("Your Redis configuration uses the namespace '#{namespace}' but the redis-namespace gem is not included in the Gemfile." \
|
||||||
"Add the gem to your Gemfile in case you would like to keep using a namespace, otherwise remove the namespace parameter.")
|
"Add the gem to your Gemfile to continue using a namespace. Otherwise, remove the namespace parameter.")
|
||||||
exit(-127)
|
exit(-127)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'sidekiq'
|
require 'sidekiq'
|
||||||
require 'sidekiq/util'
|
require 'sidekiq/util'
|
||||||
require 'sidekiq/api'
|
require 'sidekiq/api'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'securerandom'
|
require 'securerandom'
|
||||||
require 'sidekiq'
|
require 'sidekiq'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'sidekiq/testing'
|
require 'sidekiq/testing'
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'socket'
|
require 'socket'
|
||||||
require 'securerandom'
|
require 'securerandom'
|
||||||
require 'sidekiq/exception_handler'
|
require 'sidekiq/exception_handler'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
module Sidekiq
|
module Sidekiq
|
||||||
VERSION = "4.1.1"
|
VERSION = "4.1.2"
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'erb'
|
require 'erb'
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
require 'sinatra/base'
|
require 'sinatra/base'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'uri'
|
require 'uri'
|
||||||
|
|
||||||
module Sidekiq
|
module Sidekiq
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'sidekiq/client'
|
require 'sidekiq/client'
|
||||||
require 'sidekiq/core_ext'
|
require 'sidekiq/core_ext'
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@ source 'https://rubygems.org'
|
||||||
|
|
||||||
gem 'pry'
|
gem 'pry'
|
||||||
gem 'sidekiq', :path => '..'
|
gem 'sidekiq', :path => '..'
|
||||||
gem 'rails', '5.0.0.beta4'
|
gem 'rails', '5.0.0.rc1'
|
||||||
gem 'rack', '2.0.0.alpha'
|
gem 'rack', '2.0.0.rc1'
|
||||||
gem 'sinatra', github: 'sinatra/sinatra'
|
gem 'sinatra', github: 'sinatra/sinatra'
|
||||||
|
|
||||||
platforms :ruby do
|
platforms :ruby do
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
Sidekiq.configure_client do |config|
|
Sidekiq.configure_client do |config|
|
||||||
config.redis = { :size => 2, :namespace => 'foo' }
|
config.redis = { :size => 2 }
|
||||||
end
|
end
|
||||||
Sidekiq.configure_server do |config|
|
Sidekiq.configure_server do |config|
|
||||||
config.redis = { :namespace => 'foo' }
|
|
||||||
config.on(:startup) { }
|
config.on(:startup) { }
|
||||||
config.on(:quiet) { }
|
config.on(:quiet) { }
|
||||||
config.on(:shutdown) do
|
config.on(:shutdown) do
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
# frozen_string_literal: true
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
$TESTING = true
|
$TESTING = true
|
||||||
# disable minitest/parallel threads
|
# disable minitest/parallel threads
|
||||||
ENV["N"] = "0"
|
ENV["N"] = "0"
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
require 'sidekiq/cli'
|
require 'sidekiq/cli'
|
||||||
require 'sidekiq/fetch'
|
require 'sidekiq/fetch'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
require 'sidekiq/api'
|
require 'sidekiq/api'
|
||||||
require 'active_job'
|
require 'active_job'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
require 'sidekiq/cli'
|
require 'sidekiq/cli'
|
||||||
require 'tempfile'
|
require 'tempfile'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
|
|
||||||
class TestClient < Sidekiq::Test
|
class TestClient < Sidekiq::Test
|
||||||
|
@ -125,6 +126,10 @@ class TestClient < Sidekiq::Test
|
||||||
assert_match(/[0-9a-f]{12}/, jid)
|
assert_match(/[0-9a-f]{12}/, jid)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
it 'handles no jobs' do
|
||||||
|
result = Sidekiq::Client.push_bulk('class' => 'QueuedWorker', 'args' => [])
|
||||||
|
assert_equal 0, result.size
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class BaseWorker
|
class BaseWorker
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
require 'sidekiq/exception_handler'
|
require 'sidekiq/exception_handler'
|
||||||
require 'stringio'
|
require 'stringio'
|
||||||
|
@ -32,7 +33,7 @@ class TestExceptionHandler < Sidekiq::Test
|
||||||
Component.new.invoke_exception(:a => 1)
|
Component.new.invoke_exception(:a => 1)
|
||||||
@str_logger.rewind
|
@str_logger.rewind
|
||||||
log = @str_logger.readlines
|
log = @str_logger.readlines
|
||||||
assert_match(/a=>1/, log[0], "didn't include the context")
|
assert_match(/"a":1/, log[0], "didn't include the context")
|
||||||
assert_match(/Something didn't work!/, log[1], "didn't include the exception message")
|
assert_match(/Something didn't work!/, log[1], "didn't include the exception message")
|
||||||
assert_match(/test\/test_exception_handler.rb/, log[2], "didn't include the backtrace")
|
assert_match(/test\/test_exception_handler.rb/, log[2], "didn't include the backtrace")
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
require 'sidekiq'
|
require 'sidekiq'
|
||||||
require 'active_record'
|
require 'active_record'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
require 'sidekiq/fetch'
|
require 'sidekiq/fetch'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
require 'sidekiq/launcher'
|
require 'sidekiq/launcher'
|
||||||
|
|
||||||
|
@ -55,6 +56,10 @@ class TestLauncher < Sidekiq::Test
|
||||||
@launcher.heartbeat('identity', heartbeat_data, Sidekiq.dump_json(heartbeat_data))
|
@launcher.heartbeat('identity', heartbeat_data, Sidekiq.dump_json(heartbeat_data))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#after do
|
||||||
|
#puts system('redis-cli -n 15 keys "*" | while read LINE ; do TTL=`redis-cli -n 15 ttl "$LINE"`; if [ "$TTL" -eq -1 ]; then echo "$LINE"; fi; done;')
|
||||||
|
#end
|
||||||
|
|
||||||
it 'indicates stopping status in proctitle' do
|
it 'indicates stopping status in proctitle' do
|
||||||
assert_equal "sidekiq #{Sidekiq::VERSION} myapp [1 of 3 busy] stopping", $0
|
assert_equal "sidekiq #{Sidekiq::VERSION} myapp [1 of 3 busy] stopping", $0
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
require 'sidekiq/logging'
|
require 'sidekiq/logging'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
require 'sidekiq/manager'
|
require 'sidekiq/manager'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
require 'sidekiq/middleware/chain'
|
require 'sidekiq/middleware/chain'
|
||||||
require 'sidekiq/processor'
|
require 'sidekiq/processor'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
require 'sidekiq/fetch'
|
require 'sidekiq/fetch'
|
||||||
require 'sidekiq/cli'
|
require 'sidekiq/cli'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
|
|
||||||
$HAS_AJ = true
|
$HAS_AJ = true
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
|
|
||||||
class TestRedisConnection < Sidekiq::Test
|
class TestRedisConnection < Sidekiq::Test
|
||||||
|
@ -26,11 +27,16 @@ class TestRedisConnection < Sidekiq::Test
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "namespace" do
|
describe "namespace" do
|
||||||
it "uses a given :namespace" do
|
it "uses a given :namespace set by a symbol key" do
|
||||||
pool = Sidekiq::RedisConnection.create(:namespace => "xxx")
|
pool = Sidekiq::RedisConnection.create(:namespace => "xxx")
|
||||||
assert_equal "xxx", pool.checkout.namespace
|
assert_equal "xxx", pool.checkout.namespace
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "uses a given :namespace set by a string key" do
|
||||||
|
pool = Sidekiq::RedisConnection.create("namespace" => "xxx")
|
||||||
|
assert_equal "xxx", pool.checkout.namespace
|
||||||
|
end
|
||||||
|
|
||||||
it "uses given :namespace over :namespace from Sidekiq.options" do
|
it "uses given :namespace over :namespace from Sidekiq.options" do
|
||||||
Sidekiq.options[:namespace] = "xxx"
|
Sidekiq.options[:namespace] = "xxx"
|
||||||
pool = Sidekiq::RedisConnection.create(:namespace => "yyy")
|
pool = Sidekiq::RedisConnection.create(:namespace => "yyy")
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
require 'sidekiq/scheduled'
|
require 'sidekiq/scheduled'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
require 'sidekiq/scheduled'
|
require 'sidekiq/scheduled'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
require 'sidekiq/scheduled'
|
require 'sidekiq/scheduled'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
|
|
||||||
require 'active_record'
|
require 'active_record'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
|
|
||||||
require 'active_record'
|
require 'active_record'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
|
|
||||||
require 'active_record'
|
require 'active_record'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
|
|
||||||
class TestUtil < Sidekiq::Test
|
class TestUtil < Sidekiq::Test
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
require 'sidekiq/web'
|
require 'sidekiq/web'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
|
|
||||||
class TestWebHelpers < Sidekiq::Test
|
class TestWebHelpers < Sidekiq::Test
|
||||||
|
|
|
@ -76,3 +76,4 @@ en: # <---- change this to your locale code
|
||||||
Plugins: Plugins
|
Plugins: Plugins
|
||||||
NotYetEnqueued: Not yet enqueued
|
NotYetEnqueued: Not yet enqueued
|
||||||
CreatedAt: Created At
|
CreatedAt: Created At
|
||||||
|
BackToApp: Back to App
|
||||||
|
|
|
@ -73,3 +73,6 @@ ru:
|
||||||
QuietAll: Отдыхать всем
|
QuietAll: Отдыхать всем
|
||||||
PollingInterval: Интервал опроса
|
PollingInterval: Интервал опроса
|
||||||
Plugins: Плагины
|
Plugins: Плагины
|
||||||
|
NotYetEnqueued: Пока не в очереди
|
||||||
|
CreatedAt: Создан
|
||||||
|
BackToApp: Назад
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
<div class="poll-wrapper pull-right">
|
<div class="poll-wrapper pull-right">
|
||||||
<%= erb :_poll_link %>
|
<%= erb :_poll_link %>
|
||||||
<% if Sidekiq::Web.app_url %>
|
<% if Sidekiq::Web.app_url %>
|
||||||
<a class="btn btn-inverse" href="<%= Sidekiq::Web.app_url %>">Back to App</a>
|
<a class="btn btn-inverse" href="<%= Sidekiq::Web.app_url %>"><%= t('BackToApp') %></a>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<form method="POST" style="margin-top: 20px; margin-bottom: 10px;">
|
<form method="POST" style="margin-top: 20px; margin-bottom: 10px;">
|
||||||
<%= csrf_tag %>
|
<%= csrf_tag %>
|
||||||
<div class="btn-group pull-right">
|
<div class="btn-group pull-right">
|
||||||
<button class="btn btn-warn" type="submit" name="quiet" value="1"><%= t('QuietAll') %></button>
|
<button class="btn btn-warn" type="submit" name="quiet" value="1" data-confirm="<%= t('AreYouSure') %>"><%= t('QuietAll') %></button>
|
||||||
<button class="btn btn-danger" type="submit" name="stop" value="1"><%= t('StopAll') %></button>
|
<button class="btn btn-danger" type="submit" name="stop" value="1" data-confirm="<%= t('AreYouSure') %>"><%= t('StopAll') %></button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue