sidekiq 5.2.8 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sidekiq might be problematic. Click here for more details.

Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -2
  3. data/.standard.yml +20 -0
  4. data/6.0-Upgrade.md +70 -0
  5. data/Changes.md +31 -3
  6. data/Ent-2.0-Upgrade.md +37 -0
  7. data/Ent-Changes.md +12 -0
  8. data/Gemfile +12 -11
  9. data/Gemfile.lock +196 -0
  10. data/Pro-5.0-Upgrade.md +25 -0
  11. data/Pro-Changes.md +12 -3
  12. data/README.md +16 -30
  13. data/Rakefile +5 -4
  14. data/bin/sidekiqload +26 -22
  15. data/bin/sidekiqmon +9 -0
  16. data/lib/generators/sidekiq/templates/worker_test.rb.erb +1 -1
  17. data/lib/generators/sidekiq/worker_generator.rb +12 -14
  18. data/lib/sidekiq/api.rb +138 -151
  19. data/lib/sidekiq/cli.rb +97 -162
  20. data/lib/sidekiq/client.rb +45 -46
  21. data/lib/sidekiq/delay.rb +5 -6
  22. data/lib/sidekiq/exception_handler.rb +10 -12
  23. data/lib/sidekiq/extensions/action_mailer.rb +10 -20
  24. data/lib/sidekiq/extensions/active_record.rb +9 -7
  25. data/lib/sidekiq/extensions/class_methods.rb +9 -7
  26. data/lib/sidekiq/extensions/generic_proxy.rb +4 -4
  27. data/lib/sidekiq/fetch.rb +5 -6
  28. data/lib/sidekiq/job_logger.rb +37 -7
  29. data/lib/sidekiq/job_retry.rb +45 -58
  30. data/lib/sidekiq/launcher.rb +59 -51
  31. data/lib/sidekiq/logger.rb +69 -0
  32. data/lib/sidekiq/manager.rb +7 -9
  33. data/lib/sidekiq/middleware/chain.rb +3 -2
  34. data/lib/sidekiq/middleware/i18n.rb +5 -7
  35. data/lib/sidekiq/monitor.rb +148 -0
  36. data/lib/sidekiq/paginator.rb +11 -12
  37. data/lib/sidekiq/processor.rb +52 -49
  38. data/lib/sidekiq/rails.rb +23 -29
  39. data/lib/sidekiq/redis_connection.rb +31 -37
  40. data/lib/sidekiq/scheduled.rb +17 -19
  41. data/lib/sidekiq/testing/inline.rb +2 -1
  42. data/lib/sidekiq/testing.rb +22 -23
  43. data/lib/sidekiq/util.rb +17 -14
  44. data/lib/sidekiq/version.rb +2 -1
  45. data/lib/sidekiq/web/action.rb +14 -10
  46. data/lib/sidekiq/web/application.rb +60 -57
  47. data/lib/sidekiq/web/helpers.rb +66 -67
  48. data/lib/sidekiq/web/router.rb +17 -14
  49. data/lib/sidekiq/web.rb +41 -49
  50. data/lib/sidekiq/worker.rb +124 -97
  51. data/lib/sidekiq.rb +53 -42
  52. data/sidekiq.gemspec +16 -16
  53. data/web/assets/javascripts/dashboard.js +2 -21
  54. data/web/locales/ja.yml +2 -1
  55. metadata +21 -31
  56. data/.travis.yml +0 -11
  57. data/bin/sidekiqctl +0 -20
  58. data/lib/sidekiq/core_ext.rb +0 -1
  59. data/lib/sidekiq/ctl.rb +0 -221
  60. data/lib/sidekiq/logging.rb +0 -122
  61. data/lib/sidekiq/middleware/server/active_record.rb +0 -23
@@ -16,10 +16,8 @@ var gridSize=(this.orientation=="right"?1:-1)*this.graph.width;this.graph.vis.ap
16
16
  var nodes=vis.selectAll("path").data(series.stack.filter(function(d){return d.y!==null})).enter().append("svg:rect").attr("x",function(d){return graph.x(d.x)+barXOffset}).attr("y",function(d){return graph.y(d.y0+Math.abs(d.y))*(d.y<0?-1:1)}).attr("width",seriesBarWidth).attr("height",function(d){return graph.y.magnitude(Math.abs(d.y))}).attr("opacity",series.opacity).attr("transform",transform);Array.prototype.forEach.call(nodes[0],function(n){n.setAttribute("fill",series.color)});if(this.unstack)barXOffset+=seriesBarWidth},this)},_frequentInterval:function(data){var intervalCounts={};for(var i=0;i<data.length-1;i++){var interval=data[i+1].x-data[i].x;intervalCounts[interval]=intervalCounts[interval]||0;intervalCounts[interval]++}var frequentInterval={count:0,magnitude:1};var keysSorted=Rickshaw.keys(intervalCounts).sort(function asc(a,b){return Number(a)-Number(b)});keysSorted.forEach(function(i){if(frequentInterval.count<intervalCounts[i]){frequentInterval={count:intervalCounts[i],magnitude:i}}});return frequentInterval}});Rickshaw.namespace("Rickshaw.Graph.Renderer.Area");Rickshaw.Graph.Renderer.Area=Rickshaw.Class.create(Rickshaw.Graph.Renderer,{name:"area",defaults:function($super){return Rickshaw.extend($super(),{unstack:false,fill:false,stroke:false})},seriesPathFactory:function(){var graph=this.graph;var factory=d3.svg.area().x(function(d){return graph.x(d.x)}).y0(function(d){return graph.y(d.y0)}).y1(function(d){return graph.y(d.y+d.y0)}).interpolate(graph.interpolation).tension(this.tension);factory.defined&&factory.defined(function(d){return d.y!==null});return factory},seriesStrokeFactory:function(){var graph=this.graph;var factory=d3.svg.line().x(function(d){return graph.x(d.x)}).y(function(d){return graph.y(d.y+d.y0)}).interpolate(graph.interpolation).tension(this.tension);factory.defined&&factory.defined(function(d){return d.y!==null});return factory},render:function(args){args=args||{};var graph=this.graph;var series=args.series||graph.series;var vis=args.vis||graph.vis;vis.selectAll("*").remove();var method=this.unstack?"append":"insert";var data=series.filter(function(s){return!s.disabled}).map(function(s){return s.stack});var nodes=vis.selectAll("path").data(data).enter()[method]("svg:g","g");nodes.append("svg:path").attr("d",this.seriesPathFactory()).attr("class","area");if(this.stroke){nodes.append("svg:path").attr("d",this.seriesStrokeFactory()).attr("class","line")}var i=0;series.forEach(function(series){if(series.disabled)return;series.path=nodes[0][i++];this._styleSeries(series)},this)},_styleSeries:function(series){if(!series.path)return;d3.select(series.path).select(".area").attr("fill",series.color);if(this.stroke){d3.select(series.path).select(".line").attr("fill","none").attr("stroke",series.stroke||d3.interpolateRgb(series.color,"black")(.125)).attr("stroke-width",this.strokeWidth)}if(series.className){series.path.setAttribute("class",series.className)}}});Rickshaw.namespace("Rickshaw.Graph.Renderer.ScatterPlot");Rickshaw.Graph.Renderer.ScatterPlot=Rickshaw.Class.create(Rickshaw.Graph.Renderer,{name:"scatterplot",defaults:function($super){return Rickshaw.extend($super(),{unstack:true,fill:true,stroke:false,padding:{top:.01,right:.01,bottom:.01,left:.01},dotSize:4})},initialize:function($super,args){$super(args)},render:function(args){args=args||{};var graph=this.graph;var series=args.series||graph.series;var vis=args.vis||graph.vis;var dotSize=this.dotSize;vis.selectAll("*").remove();series.forEach(function(series){if(series.disabled)return;var opacity=series.opacity?series.opacity:1;var nodes=vis.selectAll("path").data(series.stack.filter(function(d){return d.y!==null})).enter().append("svg:circle").attr("cx",function(d){return graph.x(d.x)}).attr("cy",function(d){return graph.y(d.y)}).attr("r",function(d){return"r"in d?d.r:dotSize}).attr("opacity",function(d){return"opacity"in d?d.opacity:opacity});if(series.className){nodes.classed(series.className,true)}Array.prototype.forEach.call(nodes[0],function(n){n.setAttribute("fill",series.color)})},this)}});Rickshaw.namespace("Rickshaw.Graph.Renderer.Multi");Rickshaw.Graph.Renderer.Multi=Rickshaw.Class.create(Rickshaw.Graph.Renderer,{name:"multi",initialize:function($super,args){$super(args)},defaults:function($super){return Rickshaw.extend($super(),{unstack:true,fill:false,stroke:true})},configure:function($super,args){args=args||{};this.config=args;$super(args)},domain:function($super){this.graph.stackData();var domains=[];var groups=this._groups();this._stack(groups);groups.forEach(function(group){var data=group.series.filter(function(s){return!s.disabled}).map(function(s){return s.stack});if(!data.length)return;var domain=null;if(group.renderer&&group.renderer.domain){domain=group.renderer.domain(data)}else{domain=$super(data)}domains.push(domain)});var xMin=d3.min(domains.map(function(d){return d.x[0]}));var xMax=d3.max(domains.map(function(d){return d.x[1]}));var yMin=d3.min(domains.map(function(d){return d.y[0]}));var yMax=d3.max(domains.map(function(d){return d.y[1]}));return{x:[xMin,xMax],y:[yMin,yMax]}},_groups:function(){var graph=this.graph;var renderGroups={};graph.series.forEach(function(series){if(series.disabled)return;if(!renderGroups[series.renderer]){var ns="http://www.w3.org/2000/svg";var vis=document.createElementNS(ns,"g");graph.vis[0][0].appendChild(vis);var renderer=graph._renderers[series.renderer];var config={};var defaults=[this.defaults(),renderer.defaults(),this.config,this.graph];defaults.forEach(function(d){Rickshaw.extend(config,d)});renderer.configure(config);renderGroups[series.renderer]={renderer:renderer,series:[],vis:d3.select(vis)}}renderGroups[series.renderer].series.push(series)},this);var groups=[];Object.keys(renderGroups).forEach(function(key){var group=renderGroups[key];groups.push(group)});return groups},_stack:function(groups){groups.forEach(function(group){var series=group.series.filter(function(series){return!series.disabled});var data=series.map(function(series){return series.stack});if(!group.renderer.unstack){var layout=d3.layout.stack();var stackedData=Rickshaw.clone(layout(data));series.forEach(function(series,index){series._stack=Rickshaw.clone(stackedData[index])})}},this);return groups},render:function(){this.graph.series.forEach(function(series){if(!series.renderer){throw new Error("Each series needs a renderer for graph 'multi' renderer")}});this.graph.vis.selectAll("*").remove();var groups=this._groups();groups=this._stack(groups);groups.forEach(function(group){var series=group.series.filter(function(series){return!series.disabled});series.active=function(){return series};group.renderer.render({series:series,vis:group.vis});series.forEach(function(s){s.stack=s._stack||s.stack||s.data})})}});Rickshaw.namespace("Rickshaw.Graph.Renderer.LinePlot");Rickshaw.Graph.Renderer.LinePlot=Rickshaw.Class.create(Rickshaw.Graph.Renderer,{name:"lineplot",defaults:function($super){return Rickshaw.extend($super(),{unstack:true,fill:false,stroke:true,padding:{top:.01,right:.01,bottom:.01,left:.01},dotSize:3,strokeWidth:2})},seriesPathFactory:function(){var graph=this.graph;var factory=d3.svg.line().x(function(d){return graph.x(d.x)}).y(function(d){return graph.y(d.y)}).interpolate(this.graph.interpolation).tension(this.tension);factory.defined&&factory.defined(function(d){return d.y!==null});return factory},render:function(args){args=args||{};var graph=this.graph;var series=args.series||graph.series;var vis=args.vis||graph.vis;var dotSize=this.dotSize;vis.selectAll("*").remove();var data=series.filter(function(s){return!s.disabled}).map(function(s){return s.stack});var nodes=vis.selectAll("path").data(data).enter().append("svg:path").attr("d",this.seriesPathFactory());var i=0;series.forEach(function(series){if(series.disabled)return;series.path=nodes[0][i++];this._styleSeries(series)},this);series.forEach(function(series){if(series.disabled)return;var nodes=vis.selectAll("x").data(series.stack.filter(function(d){return d.y!==null})).enter().append("svg:circle").attr("cx",function(d){return graph.x(d.x)}).attr("cy",function(d){return graph.y(d.y)}).attr("r",function(d){return"r"in d?d.r:dotSize});Array.prototype.forEach.call(nodes[0],function(n){if(!n)return;n.setAttribute("data-color",series.color);n.setAttribute("fill","white");n.setAttribute("stroke",series.color);n.setAttribute("stroke-width",this.strokeWidth)}.bind(this))},this)}});Rickshaw.namespace("Rickshaw.Graph.Smoother");Rickshaw.Graph.Smoother=Rickshaw.Class.create({initialize:function(args){this.graph=args.graph;this.element=args.element;this.aggregationScale=1;this.build();this.graph.stackData.hooks.data.push({name:"smoother",orderPosition:50,f:this.transformer.bind(this)})},build:function(){var self=this;var $=jQuery;if(this.element){$(function(){$(self.element).slider({min:1,max:100,slide:function(event,ui){self.setScale(ui.value)}})})}},setScale:function(scale){if(scale<1){throw"scale out of range: "+scale}this.aggregationScale=scale;this.graph.update()},transformer:function(data){if(this.aggregationScale==1)return data;var aggregatedData=[];data.forEach(function(seriesData){var aggregatedSeriesData=[];while(seriesData.length){var avgX=0,avgY=0;var slice=seriesData.splice(0,this.aggregationScale);slice.forEach(function(d){avgX+=d.x/slice.length;avgY+=d.y/slice.length});aggregatedSeriesData.push({x:avgX,y:avgY})}aggregatedData.push(aggregatedSeriesData)}.bind(this));return aggregatedData}});Rickshaw.namespace("Rickshaw.Graph.Socketio");Rickshaw.Graph.Socketio=Rickshaw.Class.create(Rickshaw.Graph.Ajax,{request:function(){var socket=io.connect(this.dataURL);var self=this;socket.on("rickshaw",function(data){self.success(data)})}});Rickshaw.namespace("Rickshaw.Series");Rickshaw.Series=Rickshaw.Class.create(Array,{initialize:function(data,palette,options){options=options||{};this.palette=new Rickshaw.Color.Palette(palette);this.timeBase=typeof options.timeBase==="undefined"?Math.floor((new Date).getTime()/1e3):options.timeBase;var timeInterval=typeof options.timeInterval=="undefined"?1e3:options.timeInterval;this.setTimeInterval(timeInterval);if(data&&typeof data=="object"&&Array.isArray(data)){data.forEach(function(item){this.addItem(item)},this)}},addItem:function(item){if(typeof item.name==="undefined"){throw"addItem() needs a name"}item.color=item.color||this.palette.color(item.name);item.data=item.data||[];if(item.data.length===0&&this.length&&this.getIndex()>0){this[0].data.forEach(function(plot){item.data.push({x:plot.x,y:0})})}else if(item.data.length===0){item.data.push({x:this.timeBase-(this.timeInterval||0),y:0})}this.push(item);if(this.legend){this.legend.addLine(this.itemByName(item.name))}},addData:function(data,x){var index=this.getIndex();Rickshaw.keys(data).forEach(function(name){if(!this.itemByName(name)){this.addItem({name:name})}},this);this.forEach(function(item){item.data.push({x:x||(index*this.timeInterval||1)+this.timeBase,y:data[item.name]||0})},this)},getIndex:function(){return this[0]&&this[0].data&&this[0].data.length?this[0].data.length:0},itemByName:function(name){for(var i=0;i<this.length;i++){if(this[i].name==name)return this[i]}},setTimeInterval:function(iv){this.timeInterval=iv/1e3},setTimeBase:function(t){this.timeBase=t},dump:function(){var data={timeBase:this.timeBase,timeInterval:this.timeInterval,items:[]};this.forEach(function(item){var newItem={color:item.color,name:item.name,data:[]};item.data.forEach(function(plot){newItem.data.push({x:plot.x,y:plot.y})});data.items.push(newItem)});return data},load:function(data){if(data.timeInterval){this.timeInterval=data.timeInterval}if(data.timeBase){this.timeBase=data.timeBase}if(data.items){data.items.forEach(function(item){this.push(item);if(this.legend){this.legend.addLine(this.itemByName(item.name))}},this)}}});Rickshaw.Series.zeroFill=function(series){Rickshaw.Series.fill(series,0)};Rickshaw.Series.fill=function(series,fill){var x;var i=0;var data=series.map(function(s){return s.data});while(i<Math.max.apply(null,data.map(function(d){return d.length}))){x=Math.min.apply(null,data.filter(function(d){return d[i]}).map(function(d){return d[i].x}));data.forEach(function(d){if(!d[i]||d[i].x!=x){d.splice(i,0,{x:x,y:fill})}});i++}};Rickshaw.namespace("Rickshaw.Series.FixedDuration");Rickshaw.Series.FixedDuration=Rickshaw.Class.create(Rickshaw.Series,{initialize:function(data,palette,options){options=options||{};if(typeof options.timeInterval==="undefined"){throw new Error("FixedDuration series requires timeInterval")}if(typeof options.maxDataPoints==="undefined"){throw new Error("FixedDuration series requires maxDataPoints")}this.palette=new Rickshaw.Color.Palette(palette);this.timeBase=typeof options.timeBase==="undefined"?Math.floor((new Date).getTime()/1e3):options.timeBase;this.setTimeInterval(options.timeInterval);if(this[0]&&this[0].data&&this[0].data.length){this.currentSize=this[0].data.length;this.currentIndex=this[0].data.length}else{this.currentSize=0;this.currentIndex=0}this.maxDataPoints=options.maxDataPoints;if(data&&typeof data=="object"&&Array.isArray(data)){data.forEach(function(item){this.addItem(item)},this);this.currentSize+=1;this.currentIndex+=1}this.timeBase-=(this.maxDataPoints-this.currentSize)*this.timeInterval;if(typeof this.maxDataPoints!=="undefined"&&this.currentSize<this.maxDataPoints){for(var i=this.maxDataPoints-this.currentSize-1;i>1;i--){this.currentSize+=1;this.currentIndex+=1;this.forEach(function(item){item.data.unshift({x:((i-1)*this.timeInterval||1)+this.timeBase,y:0,i:i})},this)}}},addData:function($super,data,x){$super(data,x);this.currentSize+=1;this.currentIndex+=1;if(this.maxDataPoints!==undefined){while(this.currentSize>this.maxDataPoints){this.dropData()}}},dropData:function(){this.forEach(function(item){item.data.splice(0,1)});this.currentSize-=1},getIndex:function(){return this.currentIndex}});return Rickshaw});
17
17
 
18
18
  var poller;
19
-
20
19
  var realtimeGraph = function(updatePath) {
21
20
  var timeInterval = parseInt(localStorage.timeInterval || '5000');
22
-
23
21
  var graphElement = document.getElementById("realtime");
24
22
 
25
23
  var graph = new Rickshaw.Graph( {
@@ -30,8 +28,8 @@ var realtimeGraph = function(updatePath) {
30
28
  interpolation: 'linear',
31
29
 
32
30
  series: new Rickshaw.Series.FixedDuration([{ name: graphElement.dataset.failedLabel, color: '#B1003E' }, { name: graphElement.dataset.processedLabel, color: '#006f68' }], undefined, {
33
- timeInterval: timeInterval,
34
- maxDataPoints: 100,
31
+ timeInterval: timeInterval,
32
+ maxDataPoints: 100,
35
33
  })
36
34
  });
37
35
 
@@ -46,7 +44,6 @@ var realtimeGraph = function(updatePath) {
46
44
  var legend = document.querySelector('#realtime-legend');
47
45
  var Hover = Rickshaw.Class.create(Rickshaw.Graph.HoverDetail, {
48
46
  render: function(args) {
49
-
50
47
  legend.innerHTML = "";
51
48
 
52
49
  var timestamp = document.createElement('div');
@@ -68,7 +65,6 @@ var realtimeGraph = function(updatePath) {
68
65
 
69
66
  line.appendChild(swatch);
70
67
  line.appendChild(label);
71
-
72
68
  legend.appendChild(line);
73
69
 
74
70
  var dot = document.createElement('div');
@@ -77,11 +73,8 @@ var realtimeGraph = function(updatePath) {
77
73
  dot.style.borderColor = d.series.color;
78
74
 
79
75
  this.element.appendChild(dot);
80
-
81
76
  dot.className = 'dot active';
82
-
83
77
  this.show();
84
-
85
78
  }, this );
86
79
  }
87
80
  });
@@ -90,7 +83,6 @@ var realtimeGraph = function(updatePath) {
90
83
  var i = 0;
91
84
  poller = setInterval(function() {
92
85
  $.getJSON($("#history").data("update-url"), function(data) {
93
-
94
86
  if (i === 0) {
95
87
  var processed = data.sidekiq.processed;
96
88
  var failed = data.sidekiq.failed;
@@ -144,7 +136,6 @@ var historyGraph = function() {
144
136
  ]
145
137
  } );
146
138
  var x_axis = new Rickshaw.Graph.Axis.Time( { graph: graph } );
147
-
148
139
  var y_axis = new Rickshaw.Graph.Axis.Y({
149
140
  graph: graph,
150
141
  tickFormat: Rickshaw.Fixtures.Number.formatKMBT,
@@ -156,7 +147,6 @@ var historyGraph = function() {
156
147
  var legend = document.querySelector('#history-legend');
157
148
  var Hover = Rickshaw.Class.create(Rickshaw.Graph.HoverDetail, {
158
149
  render: function(args) {
159
-
160
150
  legend.innerHTML = "";
161
151
 
162
152
  var timestamp = document.createElement('div');
@@ -178,7 +168,6 @@ var historyGraph = function() {
178
168
 
179
169
  line.appendChild(swatch);
180
170
  line.appendChild(label);
181
-
182
171
  legend.appendChild(line);
183
172
 
184
173
  var dot = document.createElement('div');
@@ -187,11 +176,8 @@ var historyGraph = function() {
187
176
  dot.style.borderColor = d.series.color;
188
177
 
189
178
  this.element.appendChild(dot);
190
-
191
179
  dot.className = 'dot active';
192
-
193
180
  this.show();
194
-
195
181
  }, this );
196
182
  }
197
183
  });
@@ -216,7 +202,6 @@ var updateStatsSummary = function(data) {
216
202
  $('ul.summary li.retries span.count').html(data.retries.numberWithDelimiter())
217
203
  $('ul.summary li.enqueued span.count').html(data.enqueued.numberWithDelimiter())
218
204
  $('ul.summary li.dead span.count').html(data.dead.numberWithDelimiter())
219
-
220
205
  }
221
206
 
222
207
  var updateRedisStats = function(data) {
@@ -277,7 +262,6 @@ $(function(){
277
262
  $(document).on('mousemove', 'div.interval-slider input', function(){
278
263
  setSliderLabel($(this).val());
279
264
  });
280
-
281
265
  });
282
266
 
283
267
  // Reset graphs
@@ -300,13 +284,10 @@ var debounce = function(fn, timeout)
300
284
 
301
285
  window.onresize = function() {
302
286
  var prevWidth = window.innerWidth;
303
-
304
287
  return debounce(function () {
305
288
  var currWidth = window.innerWidth;
306
-
307
289
  if (prevWidth !== currWidth) {
308
290
  prevWidth = currWidth;
309
-
310
291
  clearInterval(poller);
311
292
  resetGraphs();
312
293
  renderGraphs();
data/web/locales/ja.yml CHANGED
@@ -33,11 +33,13 @@ ja:
33
33
  NextRetry: 再試行
34
34
  RetryCount: 再試行
35
35
  RetryNow: 今すぐ再試行
36
+ Kill: 強制終了
36
37
  LastRetry: 再試行履歴
37
38
  OriginallyFailed: 失敗
38
39
  AreYouSure: よろしいですか?
39
40
  DeleteAll: 全て削除
40
41
  RetryAll: 全て再試行
42
+ KillAll: 全て強制終了
41
43
  NoRetriesFound: 再試行するジョブはありません
42
44
  Error: エラー
43
45
  ErrorClass: エラークラス
@@ -58,7 +60,6 @@ ja:
58
60
  OneMonth: 1 ヶ月
59
61
  ThreeMonths: 3 ヶ月
60
62
  SixMonths: 6 ヶ月
61
- Batches: バッチ
62
63
  Failures: 失敗
63
64
  DeadJobs: デッドジョブ
64
65
  NoDeadJobsFound: デッドジョブはありません
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.8
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Perham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-13 00:00:00.000000000 Z
11
+ date: 2019-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -16,27 +16,18 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.3.5
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '5'
19
+ version: 4.1.0
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: 3.3.5
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '5'
26
+ version: 4.1.0
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: connection_pool
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '2.2'
40
31
  - - ">="
41
32
  - !ruby/object:Gem::Version
42
33
  version: 2.2.2
@@ -44,9 +35,6 @@ dependencies:
44
35
  prerelease: false
45
36
  version_requirements: !ruby/object:Gem::Requirement
46
37
  requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '2.2'
50
38
  - - ">="
51
39
  - !ruby/object:Gem::Version
52
40
  version: 2.2.2
@@ -54,36 +42,35 @@ dependencies:
54
42
  name: rack
55
43
  requirement: !ruby/object:Gem::Requirement
56
44
  requirements:
57
- - - "<"
45
+ - - ">="
58
46
  - !ruby/object:Gem::Version
59
- version: 2.1.0
47
+ version: 2.0.0
60
48
  type: :runtime
61
49
  prerelease: false
62
50
  version_requirements: !ruby/object:Gem::Requirement
63
51
  requirements:
64
- - - "<"
52
+ - - ">="
65
53
  - !ruby/object:Gem::Version
66
- version: 2.1.0
54
+ version: 2.0.0
67
55
  - !ruby/object:Gem::Dependency
68
56
  name: rack-protection
69
57
  requirement: !ruby/object:Gem::Requirement
70
58
  requirements:
71
59
  - - ">="
72
60
  - !ruby/object:Gem::Version
73
- version: 1.5.0
61
+ version: 2.0.0
74
62
  type: :runtime
75
63
  prerelease: false
76
64
  version_requirements: !ruby/object:Gem::Requirement
77
65
  requirements:
78
66
  - - ">="
79
67
  - !ruby/object:Gem::Version
80
- version: 1.5.0
68
+ version: 2.0.0
81
69
  description: Simple, efficient background processing for Ruby.
82
70
  email:
83
71
  - mperham@gmail.com
84
72
  executables:
85
73
  - sidekiq
86
- - sidekiqctl
87
74
  extensions: []
88
75
  extra_rdoc_files: []
89
76
  files:
@@ -91,24 +78,28 @@ files:
91
78
  - ".github/contributing.md"
92
79
  - ".github/issue_template.md"
93
80
  - ".gitignore"
94
- - ".travis.yml"
81
+ - ".standard.yml"
95
82
  - 3.0-Upgrade.md
96
83
  - 4.0-Upgrade.md
97
84
  - 5.0-Upgrade.md
85
+ - 6.0-Upgrade.md
98
86
  - COMM-LICENSE
99
87
  - Changes.md
88
+ - Ent-2.0-Upgrade.md
100
89
  - Ent-Changes.md
101
90
  - Gemfile
91
+ - Gemfile.lock
102
92
  - LICENSE
103
93
  - Pro-2.0-Upgrade.md
104
94
  - Pro-3.0-Upgrade.md
105
95
  - Pro-4.0-Upgrade.md
96
+ - Pro-5.0-Upgrade.md
106
97
  - Pro-Changes.md
107
98
  - README.md
108
99
  - Rakefile
109
100
  - bin/sidekiq
110
- - bin/sidekiqctl
111
101
  - bin/sidekiqload
102
+ - bin/sidekiqmon
112
103
  - code_of_conduct.md
113
104
  - lib/generators/sidekiq/templates/worker.rb.erb
114
105
  - lib/generators/sidekiq/templates/worker_spec.rb.erb
@@ -118,8 +109,6 @@ files:
118
109
  - lib/sidekiq/api.rb
119
110
  - lib/sidekiq/cli.rb
120
111
  - lib/sidekiq/client.rb
121
- - lib/sidekiq/core_ext.rb
122
- - lib/sidekiq/ctl.rb
123
112
  - lib/sidekiq/delay.rb
124
113
  - lib/sidekiq/exception_handler.rb
125
114
  - lib/sidekiq/extensions/action_mailer.rb
@@ -130,11 +119,11 @@ files:
130
119
  - lib/sidekiq/job_logger.rb
131
120
  - lib/sidekiq/job_retry.rb
132
121
  - lib/sidekiq/launcher.rb
133
- - lib/sidekiq/logging.rb
122
+ - lib/sidekiq/logger.rb
134
123
  - lib/sidekiq/manager.rb
135
124
  - lib/sidekiq/middleware/chain.rb
136
125
  - lib/sidekiq/middleware/i18n.rb
137
- - lib/sidekiq/middleware/server/active_record.rb
126
+ - lib/sidekiq/monitor.rb
138
127
  - lib/sidekiq/paginator.rb
139
128
  - lib/sidekiq/processor.rb
140
129
  - lib/sidekiq/rails.rb
@@ -216,14 +205,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
216
205
  requirements:
217
206
  - - ">="
218
207
  - !ruby/object:Gem::Version
219
- version: 2.2.2
208
+ version: 2.5.0
220
209
  required_rubygems_version: !ruby/object:Gem::Requirement
221
210
  requirements:
222
211
  - - ">="
223
212
  - !ruby/object:Gem::Version
224
213
  version: '0'
225
214
  requirements: []
226
- rubygems_version: 3.0.3
215
+ rubyforge_project:
216
+ rubygems_version: 2.7.6
227
217
  signing_key:
228
218
  specification_version: 4
229
219
  summary: Simple, efficient background processing for Ruby
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- cache: bundler
4
- services:
5
- - redis-server
6
- rvm:
7
- - 2.3.7
8
- - 2.4.4
9
- - 2.5.1
10
- - 2.6.0
11
- - jruby-9.2.6.0
data/bin/sidekiqctl DELETED
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'fileutils'
4
- require 'sidekiq/api'
5
- require 'sidekiq/ctl'
6
-
7
- if ARGV[0] == 'status'
8
- Sidekiq::Ctl::Status.new.display(ARGV[1])
9
- else
10
- if ARGV.length < 2
11
- Sidekiq::Ctl.print_usage
12
- else
13
- stage = ARGV[0]
14
- pidfile = ARGV[1]
15
- timeout = ARGV[2].to_i
16
- timeout = Sidekiq::Ctl::DEFAULT_KILL_TIMEOUT if timeout == 0
17
-
18
- Sidekiq::Ctl.new(stage, pidfile, timeout)
19
- end
20
- end
@@ -1 +0,0 @@
1
- raise "no longer used, will be removed in 5.1"
data/lib/sidekiq/ctl.rb DELETED
@@ -1,221 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'fileutils'
4
- require 'sidekiq/api'
5
-
6
- class Sidekiq::Ctl
7
- DEFAULT_KILL_TIMEOUT = 10
8
- CMD = File.basename($0)
9
-
10
- attr_reader :stage, :pidfile, :kill_timeout
11
-
12
- def self.print_usage
13
- puts "#{CMD} - control Sidekiq from the command line."
14
- puts
15
- puts "Usage: #{CMD} quiet <pidfile> <kill_timeout>"
16
- puts " #{CMD} stop <pidfile> <kill_timeout>"
17
- puts " #{CMD} status <section>"
18
- puts
19
- puts " <pidfile> is path to a pidfile"
20
- puts " <kill_timeout> is number of seconds to wait until Sidekiq exits"
21
- puts " (default: #{Sidekiq::Ctl::DEFAULT_KILL_TIMEOUT}), after which Sidekiq will be KILL'd"
22
- puts
23
- puts " <section> (optional) view a specific section of the status output"
24
- puts " Valid sections are: #{Sidekiq::Ctl::Status::VALID_SECTIONS.join(', ')}"
25
- puts
26
- puts "Be sure to set the kill_timeout LONGER than Sidekiq's -t timeout. If you want"
27
- puts "to wait 60 seconds for jobs to finish, use `sidekiq -t 60` and `sidekiqctl stop"
28
- puts " path_to_pidfile 61`"
29
- puts
30
- end
31
-
32
- def initialize(stage, pidfile, timeout)
33
- @stage = stage
34
- @pidfile = pidfile
35
- @kill_timeout = timeout
36
-
37
- done('No pidfile given', :error) if !pidfile
38
- done("Pidfile #{pidfile} does not exist", :warn) if !File.exist?(pidfile)
39
- done('Invalid pidfile content', :error) if pid == 0
40
-
41
- fetch_process
42
-
43
- begin
44
- send(stage)
45
- rescue NoMethodError
46
- done "Invalid command: #{stage}", :error
47
- end
48
- end
49
-
50
- def fetch_process
51
- Process.kill(0, pid)
52
- rescue Errno::ESRCH
53
- done "Process doesn't exist", :error
54
- # We were not allowed to send a signal, but the process must have existed
55
- # when Process.kill() was called.
56
- rescue Errno::EPERM
57
- return pid
58
- end
59
-
60
- def done(msg, error = nil)
61
- puts msg
62
- exit(exit_signal(error))
63
- end
64
-
65
- def exit_signal(error)
66
- (error == :error) ? 1 : 0
67
- end
68
-
69
- def pid
70
- @pid ||= File.read(pidfile).to_i
71
- end
72
-
73
- def quiet
74
- `kill -TSTP #{pid}`
75
- end
76
-
77
- def stop
78
- `kill -TERM #{pid}`
79
- kill_timeout.times do
80
- begin
81
- Process.kill(0, pid)
82
- rescue Errno::ESRCH
83
- FileUtils.rm_f pidfile
84
- done 'Sidekiq shut down gracefully.'
85
- rescue Errno::EPERM
86
- done 'Not permitted to shut down Sidekiq.'
87
- end
88
- sleep 1
89
- end
90
- `kill -9 #{pid}`
91
- FileUtils.rm_f pidfile
92
- done 'Sidekiq shut down forcefully.'
93
- end
94
- alias_method :shutdown, :stop
95
-
96
- class Status
97
- VALID_SECTIONS = %w[all version overview processes queues]
98
- def display(section = nil)
99
- section ||= 'all'
100
- unless VALID_SECTIONS.include? section
101
- puts "I don't know how to check the status of '#{section}'!"
102
- puts "Try one of these: #{VALID_SECTIONS.join(', ')}"
103
- return
104
- end
105
- send(section)
106
- rescue StandardError => e
107
- puts "Couldn't get status: #{e}"
108
- end
109
-
110
- def all
111
- version
112
- puts
113
- overview
114
- puts
115
- processes
116
- puts
117
- queues
118
- end
119
-
120
- def version
121
- puts "Sidekiq #{Sidekiq::VERSION}"
122
- puts Time.now
123
- end
124
-
125
- def overview
126
- puts '---- Overview ----'
127
- puts " Processed: #{delimit stats.processed}"
128
- puts " Failed: #{delimit stats.failed}"
129
- puts " Busy: #{delimit stats.workers_size}"
130
- puts " Enqueued: #{delimit stats.enqueued}"
131
- puts " Retries: #{delimit stats.retry_size}"
132
- puts " Scheduled: #{delimit stats.scheduled_size}"
133
- puts " Dead: #{delimit stats.dead_size}"
134
- end
135
-
136
- def processes
137
- puts "---- Processes (#{process_set.size}) ----"
138
- process_set.each_with_index do |process, index|
139
- puts "#{process['identity']} #{tags_for(process)}"
140
- puts " Started: #{Time.at(process['started_at'])} (#{time_ago(process['started_at'])})"
141
- puts " Threads: #{process['concurrency']} (#{process['busy']} busy)"
142
- puts " Queues: #{split_multiline(process['queues'].sort, pad: 11)}"
143
- puts '' unless (index+1) == process_set.size
144
- end
145
- end
146
-
147
- COL_PAD = 2
148
- def queues
149
- puts "---- Queues (#{queue_data.size}) ----"
150
- columns = {
151
- name: [:ljust, (['name'] + queue_data.map(&:name)).map(&:length).max + COL_PAD],
152
- size: [:rjust, (['size'] + queue_data.map(&:size)).map(&:length).max + COL_PAD],
153
- latency: [:rjust, (['latency'] + queue_data.map(&:latency)).map(&:length).max + COL_PAD]
154
- }
155
- columns.each { |col, (dir, width)| print col.to_s.upcase.public_send(dir, width) }
156
- puts
157
- queue_data.each do |q|
158
- columns.each do |col, (dir, width)|
159
- print q.send(col).public_send(dir, width)
160
- end
161
- puts
162
- end
163
- end
164
-
165
- private
166
-
167
- def delimit(number)
168
- number.to_s.reverse.scan(/.{1,3}/).join(',').reverse
169
- end
170
-
171
- def split_multiline(values, opts = {})
172
- return 'none' unless values
173
- pad = opts[:pad] || 0
174
- max_length = opts[:max_length] || (80 - pad)
175
- out = []
176
- line = ''
177
- values.each do |value|
178
- if (line.length + value.length) > max_length
179
- out << line
180
- line = ' ' * pad
181
- end
182
- line << value + ', '
183
- end
184
- out << line[0..-3]
185
- out.join("\n")
186
- end
187
-
188
- def tags_for(process)
189
- tags = [
190
- process['tag'],
191
- process['labels'],
192
- (process['quiet'] == 'true' ? 'quiet' : nil)
193
- ].flatten.compact
194
- tags.any? ? "[#{tags.join('] [')}]" : nil
195
- end
196
-
197
- def time_ago(timestamp)
198
- seconds = Time.now - Time.at(timestamp)
199
- return 'just now' if seconds < 60
200
- return 'a minute ago' if seconds < 120
201
- return "#{seconds.floor / 60} minutes ago" if seconds < 3600
202
- return 'an hour ago' if seconds < 7200
203
- "#{seconds.floor / 60 / 60} hours ago"
204
- end
205
-
206
- QUEUE_STRUCT = Struct.new(:name, :size, :latency)
207
- def queue_data
208
- @queue_data ||= Sidekiq::Queue.all.map do |q|
209
- QUEUE_STRUCT.new(q.name, q.size.to_s, sprintf('%#.2f', q.latency))
210
- end
211
- end
212
-
213
- def process_set
214
- @process_set ||= Sidekiq::ProcessSet.new
215
- end
216
-
217
- def stats
218
- @stats ||= Sidekiq::Stats.new
219
- end
220
- end
221
- end