rubypitaya 1.2.9 → 1.3.0

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
  SHA256:
3
- metadata.gz: 2a34f05283342d1f35366034211370ce5564c8f7c1e033c69bf6efc5aa7cfde6
4
- data.tar.gz: b1ec31931d1306144373921202b10882ea6942c77986dcaafb61800dab879ce3
3
+ metadata.gz: 308569ffd1a21f885317d944646e19c7f95159c4c64b900c3fc89bc5bca2321c
4
+ data.tar.gz: 4f89dc81fbc999187538019916121cef7d982dafd88edca1fe665518c4c9225b
5
5
  SHA512:
6
- metadata.gz: 65b562f383a9c5d8f21ba37763a5f79a9fbab1f2af016f23e5f008178ff5917894daacc4df6b35819d7db6bbf91d45c53cb020ea41ef0ce382cb6d68606f4849
7
- data.tar.gz: 83cf65e5020902691cd3149220efe2345123ae93a6c3bd057945e7b03a50642100e70f328fe13fcab8994047b9d67df0c9b94dadf593cc14952862f8a4b602e9
6
+ metadata.gz: f6a6ce18e3c2ff2afb15b1408edd05c2c9ac6920807360d21f1a2e24fc4f68912b5eabf9cf023ec873962150f7547948dab9c039b88febd0493d151fd0a27c04
7
+ data.tar.gz: 1d0272741a51cea4cd1253185ede2d3c6cbef88a328d4562eacfdc9a9269f96d0af817d51898f9ee154a3428c18aec69768e0fdbb0f27c01ea7372076ebed0a9
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem 'rubypitaya', '1.2.9'
3
+ gem 'rubypitaya', '1.3.0'
4
4
 
5
5
  group :development do
6
6
  gem 'pry', '0.12.2'
@@ -62,7 +62,7 @@ GEM
62
62
  diff-lcs (>= 1.2.0, < 2.0)
63
63
  rspec-support (~> 3.8.0)
64
64
  rspec-support (3.8.3)
65
- rubypitaya (1.2.9)
65
+ rubypitaya (1.3.0)
66
66
  activerecord (= 6.0.2)
67
67
  etcdv3 (= 0.10.2)
68
68
  eventmachine (= 1.2.7)
@@ -85,7 +85,7 @@ DEPENDENCIES
85
85
  pry (= 0.12.2)
86
86
  rake (= 10.0)
87
87
  rspec (= 3.8.0)
88
- rubypitaya (= 1.2.9)
88
+ rubypitaya (= 1.3.0)
89
89
 
90
90
  BUNDLED WITH
91
91
  1.17.2
@@ -24,7 +24,6 @@ module RubyPitaya
24
24
 
25
25
  attr_reader :redis_connector, :config, :bll
26
26
 
27
- private
28
27
  def initialize
29
28
  @environment_name = ENV.fetch("RUBYPITAYA_ENV") { 'development' }
30
29
  @is_development_environment = @environment_name == 'development'
@@ -70,11 +69,40 @@ module RubyPitaya
70
69
 
71
70
  @handler_router = HandlerRouter.new(Path::HANDLERS_FOLDER_PATH)
72
71
 
73
- puts "Server started!"
74
- run_nats_connection
72
+ run_server
73
+ end
74
+
75
+ private
76
+
77
+ def run_server
78
+ @is_shutting_down = false
79
+
80
+ catch :sig_shutdown do
81
+ Signal.trap("SIGINT") { throw :sig_shutdown }
82
+ Signal.trap("SIGQUIT") { throw :sig_shutdown }
83
+ Signal.trap("SIGTERM") { throw :sig_shutdown }
84
+
85
+ puts "Server started!"
86
+ run_nats_connection
87
+ end
88
+
89
+ Signal.trap("SIGINT", nil)
90
+ Signal.trap("SIGQUIT", nil)
91
+ Signal.trap("SIGTERM", nil)
92
+
93
+ shutdown_server
94
+ end
95
+
96
+ def shutdown_server
97
+ return if @is_shutting_down
98
+ @is_shutting_down = true
99
+
100
+ puts "Server shutting down..."
75
101
 
76
102
  @etcd_connector.disconnect
77
103
  @database_connector.disconnect
104
+
105
+ exit(0)
78
106
  end
79
107
 
80
108
  def run_nats_connection
@@ -113,9 +141,6 @@ module RubyPitaya
113
141
 
114
142
  response
115
143
  end
116
- rescue SystemExit, Interrupt
117
- puts "Quit!"
118
- return 0
119
144
  rescue Exception => error
120
145
  puts "ERROR: #{error}"
121
146
  puts error.backtrace
@@ -1,4 +1,4 @@
1
1
  module RubyPitaya
2
- VERSION = "1.2.9"
2
+ VERSION = "1.3.0"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubypitaya
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.9
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luciano Prestes Cavalcanti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-27 00:00:00.000000000 Z
11
+ date: 2020-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg