1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

merge master

This commit is contained in:
Mike Perham 2016-08-19 21:47:04 -07:00
commit 86e03e9c02
18 changed files with 111 additions and 15 deletions

View file

@ -1,11 +1,23 @@
# Sidekiq Changes # Sidekiq Changes
4.2.0 HEAD
----------- -----------
- Enable development-mode code reloading. With Rails 5.0+, you don't need - Enable development-mode code reloading. With Rails 5.0+, you don't need
to restart Sidekiq to pick up your Sidekiq::Worker changes anymore! [#2457] to restart Sidekiq to pick up your Sidekiq::Worker changes anymore! [#2457]
- Allow tuning of concurrency with the `RAILS_MAX_THREADS` env var. [#2985]
This is the same var used by Puma so you can tune all of your systems
the same way:
```sh
web: RAILS_MAX_THREADS=5 bundle exec puma ...
worker: RAILS_MAX_THREADS=10 bundle exec sidekiq ...
```
Using `-c` or `config/sidekiq.yml` overrides this setting. I recommend
adjusting your `config/database.yml` to use it too so connections are
auto-scaled:
```yaml
pool: <%= ENV['RAILS_MAX_THREADS'] || 5 %>
```
4.1.4 4.1.4
----------- -----------

View file

@ -3,7 +3,30 @@ 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 1.3.2
-------------
- Upgrade encryption to use OpenSSL's more secure GCM mode. [#3060]
1.3.1
-------------
- Fix multi-process memory monitoring on CentOS 6.x [#3063]
- Polish the new encryption feature a bit.
1.3.0
-------------
- **BETA** [New encryption feature](https://github.com/mperham/sidekiq/wiki/Ent-Encryption)
which automatically encrypts the last argument of a Worker, aka the secret bag.
1.2.4
-------------
- Fix issue causing some minutely jobs to execute every other minute.
- Log a warning if slow periodic processing causes us to miss a clock tick.
1.2.3
------------- -------------
- Periodic jobs could stop executing until process restart if Redis goes down [#3047] - Periodic jobs could stop executing until process restart if Redis goes down [#3047]

View file

@ -3,6 +3,12 @@ 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.
3.3.2
---------
- Minimize batch memory usage after success [#3083]
- Extract batch's 24 hr linger expiry to a LINGER constant so it can be tuned. [#3011]
3.3.1 3.3.1
--------- ---------

View file

@ -28,6 +28,7 @@ module Sidekiq
startup: [], startup: [],
quiet: [], quiet: [],
shutdown: [], shutdown: [],
heartbeat: [],
}, },
dead_max_jobs: 10_000, dead_max_jobs: 10_000,
dead_timeout_in_seconds: 180 * 24 * 60 * 60, # 6 months dead_timeout_in_seconds: 180 * 24 * 60 * 60, # 6 months

View file

@ -208,6 +208,8 @@ module Sidekiq
opts = parse_config(cfile).merge(opts) if cfile opts = parse_config(cfile).merge(opts) if cfile
opts[:strict] = true if opts[:strict].nil? opts[:strict] = true if opts[:strict].nil?
opts[:concurrency] = Integer(ENV["RAILS_MAX_THREADS"]) if !opts[:concurrency] && ENV["RAILS_MAX_THREADS"]
opts[:identity] = identity
options.merge!(opts) options.merge!(opts)
end end

View file

@ -94,15 +94,19 @@ module Sidekiq
end end
fails = procd = 0 fails = procd = 0
_, _, _, msg = Sidekiq.redis do |conn| _, exists, _, _, msg = Sidekiq.redis do |conn|
conn.multi do conn.multi do
conn.sadd('processes', key) conn.sadd('processes', key)
conn.exists(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)
conn.rpop("#{key}-signals") conn.rpop("#{key}-signals")
end end
end end
# first heartbeat or recovering from an outage and need to reestablish our heartbeat
fire_event(:heartbeat) if !exists
return unless msg return unless msg
if JVM_RESERVED_SIGNALS.include?(msg) if JVM_RESERVED_SIGNALS.include?(msg)

View file

@ -4,6 +4,7 @@ require 'sidekiq/util'
require 'sidekiq/processor' require 'sidekiq/processor'
require 'sidekiq/fetch' require 'sidekiq/fetch'
require 'thread' require 'thread'
require 'set'
module Sidekiq module Sidekiq

View file

@ -42,6 +42,18 @@ class TestCli < Sidekiq::Test
assert_equal 60, Sidekiq.options[:concurrency] assert_equal 60, Sidekiq.options[:concurrency]
end end
it 'changes concurrency with ENV' do
begin
ENV['RAILS_MAX_THREADS'] = '9'
@cli.parse(['sidekiq', '-c', '60', '-r', './test/fake_env.rb'])
assert_equal 60, Sidekiq.options[:concurrency]
@cli.parse(['sidekiq', '-r', './test/fake_env.rb'])
assert_equal 9, Sidekiq.options[:concurrency]
ensure
ENV.delete('RAILS_MAX_THREADS')
end
end
it 'changes queues' do it 'changes queues' do
@cli.parse(['sidekiq', '-q', 'foo', '-r', './test/fake_env.rb']) @cli.parse(['sidekiq', '-q', 'foo', '-r', './test/fake_env.rb'])
assert_equal ['foo'], Sidekiq.options[:queues] assert_equal ['foo'], Sidekiq.options[:queues]

View file

@ -15,8 +15,6 @@ class TestLauncher < Sidekiq::Test
describe 'heartbeat' do describe 'heartbeat' do
before do before do
uow = Object.new
@mgr = new_manager(options) @mgr = new_manager(options)
@launcher = Sidekiq::Launcher.new(options) @launcher = Sidekiq::Launcher.new(options)
@launcher.manager = @mgr @launcher.manager = @mgr
@ -31,6 +29,18 @@ class TestLauncher < Sidekiq::Test
$0 = @proctitle $0 = @proctitle
end end
it 'fires new heartbeat events' do
i = 0
Sidekiq.on(:heartbeat) do
i += 1
end
assert_equal 0, i
@launcher.heartbeat('identity', heartbeat_data, Sidekiq.dump_json(heartbeat_data))
assert_equal 1, i
@launcher.heartbeat('identity', heartbeat_data, Sidekiq.dump_json(heartbeat_data))
assert_equal 1, i
end
describe 'when manager is active' do describe 'when manager is active' do
before do before do
Sidekiq::CLI::PROCTITLES << proc { "xyz" } Sidekiq::CLI::PROCTITLES << proc { "xyz" }

View file

@ -752,3 +752,28 @@ div.interval-slider input {
.redis-url { .redis-url {
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.product-version {
color:white;
}
.warning-messages {
margin-top: 20px;
margin-bottom: 10px;
}
.toggle {
display: none;
}
.box {
width: 50%;
}
.checkbox-column {
width: 20px;
}
.delete-confirm {
width: 20%;
}

View file

@ -48,7 +48,7 @@ de:
NoScheduledFound: Keine geplanten Jobs gefunden NoScheduledFound: Keine geplanten Jobs gefunden
When: Wann When: Wann
ScheduledJobs: Jobs in der Warteschlange ScheduledJobs: Jobs in der Warteschlange
idle: inaktiv idle: untätig
active: aktiv active: aktiv
Version: Version Version: Version
Connections: Verbindungen Connections: Verbindungen

View file

@ -3,7 +3,7 @@
<div class="container text-center"> <div class="container text-center">
<ul class="nav"> <ul class="nav">
<li> <li>
<p class="navbar-text" style="color:white;"><%= product_version %></p> <p class="navbar-text product-version"><%= product_version %></p>
</li> </li>
<li> <li>
<p class="navbar-text redis-url" title="<%= redis_connection_and_namespace %>"><%= redis_connection_and_namespace %></p> <p class="navbar-text redis-url" title="<%= redis_connection_and_namespace %>"><%= redis_connection_and_namespace %></p>

View file

@ -3,7 +3,7 @@
<h3><%= t('Processes') %></h3> <h3><%= t('Processes') %></h3>
</div> </div>
<div class="col-sm-4 pull-right"> <div class="col-sm-4 pull-right">
<form method="POST" style="margin-top: 20px; margin-bottom: 10px;"> <form method="POST" class="warning-messages">
<%= 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" data-confirm="<%= t('AreYouSure') %>"><%= t('QuietAll') %></button> <button class="btn btn-warn" type="submit" name="quiet" value="1" data-confirm="<%= t('AreYouSure') %>"><%= t('QuietAll') %></button>
@ -24,7 +24,7 @@
</thead> </thead>
<% processes.each do |process| %> <% processes.each do |process| %>
<tr> <tr>
<td width="50%"> <td class="box">
<%= "#{process['hostname']}:#{process['pid']}" %> <%= "#{process['hostname']}:#{process['pid']}" %>
<span class="label label-success"><%= process.tag %></span> <span class="label label-success"><%= process.tag %></span>
<% process.labels.each do |label| %> <% process.labels.each do |label| %>

View file

@ -17,7 +17,7 @@
<table class="table table-striped table-bordered table-white"> <table class="table table-striped table-bordered table-white">
<thead> <thead>
<tr> <tr>
<th width="20px" class="table-checkbox"> <th class="table-checkbox checkbox-column">
<label> <label>
<input type="checkbox" class="check_all" /> <input type="checkbox" class="check_all" />
</label> </label>

View file

@ -26,7 +26,7 @@
<% if a.size > 100 %> <% if a.size > 100 %>
<%= h(msg.display_args.inspect[0..100]) + "... " %> <%= h(msg.display_args.inspect[0..100]) + "... " %>
<button data-toggle="collapse" data-target="#worker_<%= index %>" class="btn btn-default btn-xs"><%= t('ShowAll') %></button> <button data-toggle="collapse" data-target="#worker_<%= index %>" class="btn btn-default btn-xs"><%= t('ShowAll') %></button>
<div class="toggle" id="worker_<%= index %>" style="display: none;"><%= h(msg.display_args) %></div> <div class="toggle" id="worker_<%= index %>"><%= h(msg.display_args) %></div>
<% else %> <% else %>
<%= h(msg.display_args) %> <%= h(msg.display_args) %>
<% end %> <% end %>

View file

@ -16,7 +16,7 @@
<% end %> <% end %>
</td> </td>
<td><%= number_with_delimiter(queue.size) %> </td> <td><%= number_with_delimiter(queue.size) %> </td>
<td width="20%"> <td class="delete-confirm">
<form action="<%=root_path %>queues/<%= queue.name %>" method="post"> <form action="<%=root_path %>queues/<%= queue.name %>" method="post">
<%= csrf_tag %> <%= csrf_tag %>
<input class="btn btn-danger btn-xs" type="submit" name="delete" value="<%= t('Delete') %>" data-confirm="<%= t('AreYouSureDeleteQueue', :queue => h(queue.name)) %>" /> <input class="btn btn-danger btn-xs" type="submit" name="delete" value="<%= t('Delete') %>" data-confirm="<%= t('AreYouSureDeleteQueue', :queue => h(queue.name)) %>" />

View file

@ -17,7 +17,7 @@
<table class="table table-striped table-bordered table-white"> <table class="table table-striped table-bordered table-white">
<thead> <thead>
<tr> <tr>
<th width="20px" class="table-checkbox"> <th class="table-checkbox checkbox-column">
<label> <label>
<input type="checkbox" class="check_all" /> <input type="checkbox" class="check_all" />
</label> </label>

View file

@ -18,7 +18,7 @@
<table class="table table-striped table-bordered table-white"> <table class="table table-striped table-bordered table-white">
<thead> <thead>
<tr> <tr>
<th width="20px"> <th class="checkbox-column">
<input type="checkbox" class="check_all" /> <input type="checkbox" class="check_all" />
</th> </th>
<th><%= t('When') %></th> <th><%= t('When') %></th>