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 +4 -4
- data/lib/resque/pool.rb +40 -0
- data/lib/resque/pool/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e566a04f11f7455edc9e6a8cdb0a7bfb39a27c0
|
4
|
+
data.tar.gz: b91a3e83de1dc7a782bf6777a20159a51b9d1cab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6a05f22e7bd024d4b34b2d191a88df33c4ca800197c63cbe59ec423aa121cfbf5c807e08ff11e81190dedc1ffa5fc4355dabde3f5cc469c67858e79a0fe1494
|
7
|
+
data.tar.gz: 78c291c88b2a221ec3eedba82149f2f0266ca92bed338b75857b8aa7103eae31104023fc6f0b092ebd56b540c5c878d8d2a20e16cad44c9b04f1997df8aee67c
|
data/lib/resque/pool.rb
CHANGED
@@ -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
|
data/lib/resque/pool/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2018-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: resque
|