makandra_sidekiq 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1a031fd7e128b55c5af83a18fd3c66b1bce4253a71506d3d7d6e5ea863ede57
4
- data.tar.gz: 797ec99395f49ab6099288054b407a8b2b7f277539037662aaae9329bc13ce24
3
+ metadata.gz: fe216cf3996745151d6aefc183425d692e334999110947a7c1cc2114cbe4b57e
4
+ data.tar.gz: 575bb317450b8c419706c06a62c86d541e3ef2a5657de35e354f165b48d89c6b
5
5
  SHA512:
6
- metadata.gz: 9cb9832fe0e4c3ab143abcd544bd76b30dda4d916f35ce2536e2f4f7158c10dfbd9988ddfdd49be1750fa616966f284cfc58c1326b6411381b5efd11a77860a4
7
- data.tar.gz: 13881f0bd8099f15bcf8c838b256d33e0f5b7dd7542696f696f1a6cc973ca2517fa8b42a796d152fcdc2c1941453caed35be51613914377963692c99e729cca7
6
+ metadata.gz: 44225769a2c6ad71c57c820ec519da9edd7cd912e95d5679727384aa73d287142244657ae1f1bd3fe160963f8e2a5ad001ef73bb2a436bb8da62c6e21c6275ac
7
+ data.tar.gz: 307dbf80b79f73374c464c32184fbe80fbde6d4d3a34b3ecce420c2281f031228472c9ca4cfa6e2340538f0b6a2b3158c92bbdd176f6a190d4465cac6381ce13
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.3.3
1
+ 2.6.5
data/.travis.yml CHANGED
@@ -1,12 +1,10 @@
1
1
  sudo: false
2
2
  language: ruby
3
+ dist: trusty
3
4
  rvm:
4
5
  - 2.3.3
5
6
  script: bundle exec rspec spec
6
7
  cache: bundler
7
- notifications:
8
- email:
9
- - fail@makandra.de
10
8
  branches:
11
9
  only:
12
10
  - master
data/CHANGELOG.md CHANGED
@@ -1,20 +1,30 @@
1
- # makandra_sidekiq change log
2
-
1
+ # Changelog
3
2
  All notable changes to this project will be documented in this file.
4
3
 
5
- ## [0.1.3][] (2017-02-13)
4
+ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
5
+
6
+
7
+ ## Unreleased
8
+
9
+ ### Compatible changes
10
+ - CHANGELOG to satisfy [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) format
6
11
 
7
- Gem no longer depends on `capistrano`, since using its Capistrano recipes is optional.
12
+ ## 0.1.3 2017-02-13
8
13
 
9
- ## [0.1.2][] (2017-01-12)
14
+ ### Changed
15
+ - Gem no longer depends on `capistrano`, since using its Capistrano recipes is optional.
10
16
 
11
- `sidekiq:start` checks that sidekiq really comes up and will retry a few times.
17
+ ## 0.1.2 2017-01-12
12
18
 
13
- ## [0.1.1][] (2016-09-29)
19
+ ### Added
20
+ - `sidekiq:start` checks that sidekiq really comes up and will retry a few times.
14
21
 
15
- Do not fail on first deploy.
22
+ ## 0.1.1 2016-09-29
16
23
 
24
+ ### Fixed
25
+ - Do not fail on first deploy.
17
26
 
18
- ## [0.1.0][] (2016-09-29)
27
+ ## 0.1.0] 2016-09-29
19
28
 
20
- Initial release.
29
+ ### Added
30
+ - Initial release.
data/Gemfile.lock CHANGED
@@ -1,13 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- makandra_sidekiq (0.1.4)
4
+ makandra_sidekiq (0.1.5)
5
+ sidekiq (< 6)
5
6
 
6
7
  GEM
7
8
  remote: https://rubygems.org/
8
9
  specs:
9
- diff-lcs (1.2.5)
10
+ connection_pool (2.2.2)
11
+ diff-lcs (1.3)
12
+ rack (2.0.7)
13
+ rack-protection (2.0.7)
14
+ rack
10
15
  rake (10.5.0)
16
+ redis (4.1.3)
11
17
  rspec (3.5.0)
12
18
  rspec-core (~> 3.5.0)
13
19
  rspec-expectations (~> 3.5.0)
@@ -21,6 +27,11 @@ GEM
21
27
  diff-lcs (>= 1.2.0, < 2.0)
22
28
  rspec-support (~> 3.5.0)
23
29
  rspec-support (3.5.0)
30
+ sidekiq (5.2.7)
31
+ connection_pool (~> 2.2, >= 2.2.2)
32
+ rack (>= 1.5.0)
33
+ rack-protection (>= 1.5.0)
34
+ redis (>= 3.3.5, < 5)
24
35
 
25
36
  PLATFORMS
26
37
  ruby
@@ -32,4 +43,4 @@ DEPENDENCIES
32
43
  rspec (~> 3.0)
33
44
 
34
45
  BUNDLED WITH
35
- 1.16.1
46
+ 1.17.2
@@ -1,4 +1,5 @@
1
1
  require 'bundler'
2
+ require 'sidekiq'
2
3
  require 'pathname'
3
4
  require 'yaml'
4
5
  require 'open3'
@@ -17,7 +18,7 @@ module MakandraSidekiq
17
18
  def quiet
18
19
  if running?
19
20
  puts 'Preventing Sidekiq from accepting new jobs...'
20
- run_sidekiqctl('quiet')
21
+ sidekiqctl_quiet
21
22
  else
22
23
  puts 'Sidekiq is not running.'
23
24
  end
@@ -26,7 +27,7 @@ module MakandraSidekiq
26
27
  def stop
27
28
  if running?
28
29
  puts 'Stopping Sidekiq...'
29
- run_sidekiqctl('stop')
30
+ sidekiqctl_stop
30
31
  else
31
32
  puts 'Sidekiq is not running.'
32
33
  end
@@ -56,6 +57,11 @@ module MakandraSidekiq
56
57
  @pid_file ||= @root.join(@config[:pidfile])
57
58
  end
58
59
 
60
+ # The shutdown timeout for Sidekiq
61
+ def timeout
62
+ @timeout ||= @config[:timeout] || Sidekiq::DEFAULTS[:timeout]
63
+ end
64
+
59
65
  def read_pid
60
66
  if pid_file.file?
61
67
  pid_file.read.to_i
@@ -94,8 +100,16 @@ module MakandraSidekiq
94
100
  config
95
101
  end
96
102
 
97
- def run_sidekiqctl(command)
98
- bundle_exec('sidekiqctl', command, pid_file.to_s)
103
+ def sidekiqctl_quiet
104
+ bundle_exec 'sidekiqctl', 'quiet', pid_file
105
+ end
106
+
107
+ def sidekiqctl_stop
108
+ # The "hard kill after" timeout for sidekiqctl. Adding a few seconds to be
109
+ # sure that jobs running at shutdown are requeued by Sidekiq.
110
+ safe_timeout = timeout + 2 # seconds
111
+
112
+ bundle_exec 'sidekiqctl', 'stop', pid_file, safe_timeout
99
113
  end
100
114
 
101
115
  def patiently_start_sidekiq
@@ -151,7 +165,8 @@ module MakandraSidekiq
151
165
  end
152
166
 
153
167
  def bundle_exec(*command)
154
- stdout_str, stderr_str, status = Bundler.with_clean_env { Open3.capture3('bundle', 'exec', *command, chdir: @root.to_s) }
168
+ string_command = command.map(&:to_s)
169
+ stdout_str, stderr_str, status = Bundler.with_clean_env { Open3.capture3('bundle', 'exec', *string_command, chdir: @root.to_s) }
155
170
  puts stdout_str
156
171
  unless status.success?
157
172
  fail "#{command} failed with message: #{stderr_str}"
@@ -1,3 +1,3 @@
1
1
  module MakandraSidekiq
2
- VERSION = '0.1.4'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -17,6 +17,8 @@ Gem::Specification.new do |spec|
17
17
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
18
  spec.require_paths = ["lib"]
19
19
 
20
+ spec.add_dependency "sidekiq", "< 6"
21
+
20
22
  spec.add_development_dependency "bundler", "~> 1.12"
21
23
  spec.add_development_dependency "rake", "~> 10.0"
22
24
  spec.add_development_dependency "rspec", "~> 3.0"
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: makandra_sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Kraze
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-11 00:00:00.000000000 Z
11
+ date: 2019-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sidekiq
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "<"
18
+ - !ruby/object:Gem::Version
19
+ version: '6'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "<"
25
+ - !ruby/object:Gem::Version
26
+ version: '6'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -96,8 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
110
  - !ruby/object:Gem::Version
97
111
  version: '0'
98
112
  requirements: []
99
- rubyforge_project:
100
- rubygems_version: 2.7.6
113
+ rubygems_version: 3.0.3
101
114
  signing_key:
102
115
  specification_version: 4
103
116
  summary: Support code for sidekiq, including rake tasks and capistrano recipes.