heroku-resque-pool 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a36deba7950e7d71d73830f42e02c58e841dcf82
4
- data.tar.gz: ea848800e2f3f7548a85b72248cb0dcb1adaf3db
3
+ metadata.gz: 3e566a04f11f7455edc9e6a8cdb0a7bfb39a27c0
4
+ data.tar.gz: b91a3e83de1dc7a782bf6777a20159a51b9d1cab
5
5
  SHA512:
6
- metadata.gz: 656a72bc46f52b2c16d83264b208797cd6dd0cb9eb58dfc8db2dc869041b7d586e4ec31fcbc9c819b266bbdf86b288bfd12676c404d65268d5e4a89b403d5b2c
7
- data.tar.gz: 9c82d30a405d7ee0335b10b446780894434ea12669ce13a365cb8ab580f1c02ca29baa7b30dd67c32230d642a845d77373a822211239d2d4cc70bd54a1c2173f
6
+ metadata.gz: f6a05f22e7bd024d4b34b2d191a88df33c4ca800197c63cbe59ec423aa121cfbf5c807e08ff11e81190dedc1ffa5fc4355dabde3f5cc469c67858e79a0fe1494
7
+ data.tar.gz: 78c291c88b2a221ec3eedba82149f2f0266ca92bed338b75857b8aa7103eae31104023fc6f0b092ebd56b540c5c878d8d2a20e16cad44c9b04f1997df8aee67c
@@ -9,7 +9,47 @@ require 'erb'
9
9
  require 'fcntl'
10
10
  require 'yaml'
11
11
 
12
+ $HEROKU_WILL_TERMINATE_RESQUE = false
13
+
14
+ Resque.class_eval do
15
+ def self.heroku_will_terminate?
16
+ !!$HEROKU_WILL_TERMINATE_RESQUE
17
+ end
18
+ end
19
+
20
+ # https://github.com/resque/resque/issues/1559#issuecomment-310908574
21
+
22
+
12
23
  module Resque
24
+ class Worker
25
+ def unregister_signal_handlers
26
+ trap('TERM') do
27
+ $HEROKU_WILL_TERMINATE_RESQUE = true
28
+
29
+ trap('TERM') do
30
+ log_with_severity :info, "[resque-heroku] received second term signal, throwing term exception"
31
+
32
+ trap('TERM') do
33
+ log_with_severity :info, "[resque-heroku] third or more time receiving TERM, ignoring"
34
+ end
35
+
36
+ raise Resque::TermException.new("SIGTERM")
37
+ end
38
+
39
+ log_with_severity :info, "[resque-heroku] received first term signal from heroku, ignoring"
40
+ end
41
+
42
+ trap('INT', 'DEFAULT')
43
+
44
+ begin
45
+ trap('QUIT', 'DEFAULT')
46
+ trap('USR1', 'DEFAULT')
47
+ trap('USR2', 'DEFAULT')
48
+ rescue ArgumentError
49
+ end
50
+ end
51
+ end
52
+
13
53
  class Pool
14
54
  SIG_QUEUE_MAX_SIZE = 5
15
55
  DEFAULT_WORKER_INTERVAL = 5
@@ -1,5 +1,5 @@
1
1
  module Resque
2
2
  class Pool
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku-resque-pool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - matthew bramfeld
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-12 00:00:00.000000000 Z
11
+ date: 2018-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: resque