griffin 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/griffin.gemspec +1 -1
- data/lib/griffin/engine/worker.rb +28 -4
- data/lib/griffin/server.rb +8 -0
- data/lib/griffin/server_config_builder.rb +1 -0
- data/lib/griffin/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88012127751815ee208777e0b26726b32941c06f312d4cadc0ccbf4f58a4c645
|
4
|
+
data.tar.gz: 312eb9afccef8d2edc0f42d57fca716bcccaf3166c6f72dfb37ebc632d212ed7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48d451452794366756fb8f9ea13f2ce5c1f08c07ee8b11b2477ff4934b11cf7c2a84b98859594836e0f348bfbefc8bc9d1437fd9c73bd0f4539d0a6c844f50af
|
7
|
+
data.tar.gz: 14b127ce13955d3a354856693299ee93e1d390988f73d96c1b8b2a00cd2a29c4578f8c003392ded533fc6450c43d914533eec85e94bd12cdeaee3a7618dc060d
|
data/griffin.gemspec
CHANGED
@@ -28,6 +28,6 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency 'rspec'
|
29
29
|
spec.add_development_dependency 'rubocop'
|
30
30
|
|
31
|
-
spec.add_dependency 'grpc_kit', '>= 0.3.
|
31
|
+
spec.add_dependency 'grpc_kit', '>= 0.3.6'
|
32
32
|
spec.add_dependency 'serverengine', '~> 2.0.7'
|
33
33
|
end
|
@@ -19,12 +19,36 @@ module Griffin
|
|
19
19
|
@lsock.close if @lsock
|
20
20
|
end
|
21
21
|
|
22
|
-
def stop
|
23
|
-
|
22
|
+
def stop(signal = nil)
|
23
|
+
kind = case signal
|
24
|
+
when ServerEngine::Signals::GRACEFUL_STOP then Griffin::Server::GRACEFUL_SHUTDOWN
|
25
|
+
when ServerEngine::Signals::IMMEDIATE_STOP then Griffin::Server::FORCE_SHUTDOWN
|
26
|
+
when ServerEngine::Signals::GRACEFUL_RESTART then Griffin::Server::GRACEFUL_RESTART
|
27
|
+
else Griffin::Server::GRACEFUL_SHUTDOWN
|
28
|
+
end
|
29
|
+
server.core.shutdown(kind)
|
24
30
|
end
|
25
31
|
|
26
|
-
#
|
27
|
-
#
|
32
|
+
# Overwrite to identify the kind of signal in #stop
|
33
|
+
# https://github.com/treasure-data/serverengine/blob/a005f3535affaa5b15d1e66486d9349443398dd2/lib/serverengine/worker.rb#L61-L78
|
34
|
+
def install_signal_handlers
|
35
|
+
w = self
|
36
|
+
ServerEngine::SignalThread.new do |st|
|
37
|
+
st.trap(ServerEngine::Signals::GRACEFUL_STOP) { |s| w.stop(s) }
|
38
|
+
st.trap(ServerEngine::Signals::IMMEDIATE_STOP, 'SIG_DFL')
|
39
|
+
|
40
|
+
st.trap(ServerEngine::Signals::GRACEFUL_RESTART) { |s| w.stop(s) }
|
41
|
+
st.trap(ServerEngine::Signals::IMMEDIATE_RESTART, 'SIG_DFL')
|
42
|
+
|
43
|
+
st.trap(ServerEngine::Signals::RELOAD) {
|
44
|
+
w.logger.reopen!
|
45
|
+
w.reload
|
46
|
+
}
|
47
|
+
st.trap(ServerEngine::Signals::DETACH) { |s| w.stop(s) }
|
48
|
+
|
49
|
+
st.trap(ServerEngine::Signals::DUMP) { w.dump }
|
50
|
+
end
|
51
|
+
end
|
28
52
|
end
|
29
53
|
end
|
30
54
|
end
|
data/lib/griffin/server.rb
CHANGED
@@ -12,6 +12,7 @@ module Griffin
|
|
12
12
|
|
13
13
|
GRACEFUL_SHUTDOWN = '0'
|
14
14
|
FORCIBLE_SHUTDOWN = '1'
|
15
|
+
GRACEFUL_RESTART = '2'
|
15
16
|
|
16
17
|
class << self
|
17
18
|
# @param bind [String]
|
@@ -131,6 +132,13 @@ module Griffin
|
|
131
132
|
@status = :stop
|
132
133
|
@server.graceful_shutdown
|
133
134
|
true
|
135
|
+
when GRACEFUL_RESTART
|
136
|
+
Griffin.logger.info("Restart sever(id=#{@worker_id}) gracefully...")
|
137
|
+
|
138
|
+
@status = :restart
|
139
|
+
# timeout is false since we don't know when all connections are closed by clients.
|
140
|
+
@server.graceful_shutdown(timeout: false)
|
141
|
+
true
|
134
142
|
end
|
135
143
|
end
|
136
144
|
end
|
data/lib/griffin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: griffin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuta Iwama
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.3.
|
89
|
+
version: 0.3.6
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.3.
|
96
|
+
version: 0.3.6
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: serverengine
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|