resque-heroku-signals 1.27.4.2 → 2.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
- SHA1:
3
- metadata.gz: 32e4dc2857b3a023cebda645c4de0471c5ec8c6c
4
- data.tar.gz: 2909dac3fe78ac1dc81148738a12d973647af6a0
2
+ SHA256:
3
+ metadata.gz: 050fcc04c58ede352eb4c15d6a69e2cf49e58ee2d8bac91523d524ac3484c2e5
4
+ data.tar.gz: c5a9171250f88404d4c9c4e5973ea947ff8446d9f87d3727ba3f743cbbdfe088
5
5
  SHA512:
6
- metadata.gz: 3a7bf798568412f2343f842e3ffc45de06f673728368b2084b9c810a0dcf3e3948d775a0005befbc5a47ba2c863924f3db0ce43af2926b21fc66a618d6c6b418
7
- data.tar.gz: f85109d7c9739200a0c258ed457c514417b2dde880076b542327d50ae71b9b9d5f960bfa780cfce42a965d54f9947ac732f231f57a9aeb126cf4e135f3068f75
6
+ metadata.gz: c75d31ef8b04127313928444c44233207b6553d1c2325ebf0fc6594470414b3a88e5b915c2162f752bee50aa1ecdf9abf3d599acb799b8239d12cdcb408aa8d4
7
+ data.tar.gz: 5ee48d48036d0461e437c1f09497e264d6022c80870a0cd329b893a9b0497649cd7f8d8c2b3c4c3ff4ae744762d99c55a54efbc079ac0b3c6e004005112f8515
@@ -0,0 +1,12 @@
1
+ version: 2
2
+
3
+ updates:
4
+ - package-ecosystem: "github-actions"
5
+ directory: "/"
6
+ schedule:
7
+ interval: "weekly"
8
+
9
+ - package-ecosystem: "bundler"
10
+ directory: "/"
11
+ schedule:
12
+ interval: "weekly"
@@ -0,0 +1,24 @@
1
+ on: [push, pull_request]
2
+
3
+ jobs:
4
+ test:
5
+ runs-on: ubuntu-latest
6
+ services:
7
+ redis:
8
+ image: redis
9
+ ports:
10
+ - 6379:6379
11
+ strategy:
12
+ matrix:
13
+ ruby-version: ['3.0', 2.7, 2.6, 2.5, 2.4]
14
+
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - name: Set up Ruby ${{ matrix.ruby-version }}
18
+ uses: ruby/setup-ruby@v1
19
+ with:
20
+ ruby-version: ${{ matrix.ruby-version }}
21
+ - name: Install dependencies
22
+ run: bundle install
23
+ - name: Run tests
24
+ run: bundle exec rake
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.3
data/Gemfile CHANGED
@@ -1,2 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
+
4
+ gem 'pry'
5
+ gem 'pry-byebug'
data/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ [![Gem Version](https://badge.fury.io/rb/resque-heroku-signals.svg)](https://badge.fury.io/rb/resque-heroku-signals)
2
+ [![Ruby](https://github.com/iloveitaly/resque-heroku-signals/actions/workflows/ci.yml/badge.svg)](https://github.com/iloveitaly/resque-heroku-signals/actions/workflows/ci.yml)
3
+
1
4
  # resque-heroku-signals
2
5
 
3
6
  This gem patches resque to be compatible with the Heroku platform. Specifically it
@@ -15,7 +18,15 @@ Add this line to your application's Gemfile:
15
18
  gem 'resque-heroku-signals'
16
19
  ```
17
20
 
18
- Since this gem monkeypatches the Heroku worker the `gemspec` is locked to a `x.x.x` version of Resque. Issue a PR if this is not compatible with the version of resque you are using.
21
+ Since this gem monkeypatches the Heroku worker the `gemspec` is locked to a `x.x.x` version of Resque to ensure the monkeypatched logic is compatible with any changes in the original Resque logic. Issue a PR if this is not compatible with the version of resque you are using.
22
+
23
+ ## Determining When a Process Will Shutdown
24
+
25
+ Heroku sends a `TERM` signal to a process before hard killing it. If your job communicates with slow external APIs, you may want to make sure you have enough time to receive and handle the response from the external system before executing the API requests.
26
+
27
+ Ideally, using an idempotency key with each external API request is the best way to ensure that a given API request only runs. However, depending on your application logic this may not be practical and knowing if a process will be terminated in less than 30s by Heroku is a useful tool.
28
+
29
+ Use `Resque.heroku_will_terminate?` to determine if Heroku will terminate your process within 30s.
19
30
 
20
31
  ## Example Procfile
21
32
 
@@ -28,7 +39,7 @@ worker: env QUEUE=* TERM_CHILD=1 INTERVAL=0.1 RESQUE_PRE_SHUTDOWN_TIMEOUT=20 RES
28
39
  * Total shutdown time should be less than 30s. This is the time [Heroku gives you to cleanup before a `SIGKILL` is issued](https://devcenter.heroku.com/articles/dynos#shutdown)
29
40
  * `INTERVAL` seconds to wait between jobs
30
41
 
31
- Also, make you don't buffer logs: import log messages could fail to push to stdout during the worker shutdown process:
42
+ Also, make you don't buffer logs: important log messages could fail to push to stdout during the worker shutdown process:
32
43
 
33
44
  ```ruby
34
45
  $stdout.sync = true
@@ -1,9 +1,21 @@
1
1
  require 'resque'
2
2
 
3
+ $HEROKU_WILL_TERMINATE_RESQUE = false
4
+
5
+ Resque.class_eval do
6
+ def self.heroku_will_terminate?
7
+ !!$HEROKU_WILL_TERMINATE_RESQUE
8
+ end
9
+ end
10
+
11
+ # before bumping resque dependency, check to ensure implementation has not changed
12
+ # https://github.com/resque/resque/blame/v2.0.0/lib/resque/worker.rb#L406
3
13
  # https://github.com/resque/resque/issues/1559#issuecomment-310908574
4
14
  Resque::Worker.class_eval do
5
15
  def unregister_signal_handlers
6
16
  trap('TERM') do
17
+ $HEROKU_WILL_TERMINATE_RESQUE = true
18
+
7
19
  trap('TERM') do
8
20
  log_with_severity :info, "[resque-heroku] received second term signal, throwing term exception"
9
21
 
@@ -15,7 +27,6 @@ Resque::Worker.class_eval do
15
27
  end
16
28
 
17
29
  log_with_severity :info, "[resque-heroku] received first term signal from heroku, ignoring"
18
-
19
30
  end
20
31
 
21
32
  trap('INT', 'DEFAULT')
@@ -4,12 +4,12 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "resque-heroku-signals"
7
- spec.version = '1.27.4.2'
7
+ spec.version = '2.2.0'
8
8
  spec.authors = ["Michael Bianco"]
9
- spec.email = ["mike@suitesync.io"]
9
+ spec.email = ["mike@mikebian.co"]
10
10
 
11
11
  spec.summary = "Patch resque to be compatible with the Heroku platform"
12
- spec.homepage = "https://github.com/iloveitaly/resque-heroku-signals"
12
+ spec.homepage = "https://github.com/resque/resque-heroku-signals"
13
13
  spec.license = "MIT"
14
14
 
15
15
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -19,9 +19,10 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_dependency "resque", "1.27.4"
22
+ # strict resque dependency is intentional
23
+ spec.add_dependency "resque", "2.2.0"
23
24
 
24
- spec.add_development_dependency "bundler", "~> 1.14"
25
- spec.add_development_dependency "rake", "~> 10.0"
26
- spec.add_development_dependency "rspec", "~> 3.0"
25
+ spec.add_development_dependency "bundler", "~> 2.2"
26
+ spec.add_development_dependency "rake", "~> 13.0"
27
+ spec.add_development_dependency "rspec", "~> 3.10"
27
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-heroku-signals
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.27.4.2
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bianco
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-29 00:00:00.000000000 Z
11
+ date: 2021-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: resque
@@ -16,65 +16,68 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.27.4
19
+ version: 2.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.27.4
26
+ version: 2.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.14'
33
+ version: '2.2'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.14'
40
+ version: '2.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '13.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '13.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.0'
61
+ version: '3.10'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '3.0'
69
- description:
68
+ version: '3.10'
69
+ description:
70
70
  email:
71
- - mike@suitesync.io
71
+ - mike@mikebian.co
72
72
  executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
+ - ".github/.github/dependabot.yml"
77
+ - ".github/workflows/ci.yml"
76
78
  - ".gitignore"
77
79
  - ".rspec"
80
+ - ".ruby-version"
78
81
  - Gemfile
79
82
  - LICENSE.txt
80
83
  - README.md
@@ -83,11 +86,11 @@ files:
83
86
  - bin/setup
84
87
  - lib/resque-heroku-signals.rb
85
88
  - resque-heroku-signals.gemspec
86
- homepage: https://github.com/iloveitaly/resque-heroku-signals
89
+ homepage: https://github.com/resque/resque-heroku-signals
87
90
  licenses:
88
91
  - MIT
89
92
  metadata: {}
90
- post_install_message:
93
+ post_install_message:
91
94
  rdoc_options: []
92
95
  require_paths:
93
96
  - lib
@@ -102,9 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
105
  - !ruby/object:Gem::Version
103
106
  version: '0'
104
107
  requirements: []
105
- rubyforge_project:
106
- rubygems_version: 2.5.1
107
- signing_key:
108
+ rubygems_version: 3.1.6
109
+ signing_key:
108
110
  specification_version: 4
109
111
  summary: Patch resque to be compatible with the Heroku platform
110
112
  test_files: []