hermes-rb 0.9.0 → 0.9.1

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
2
  SHA256:
3
- metadata.gz: d179bf4ab92b5e5f8e4529c79451fe34a36696cc2bdb5c0397a969e64f77d666
4
- data.tar.gz: 6e967663720dbb15a70ebb5d61ed74821297f443e126b002e72eaf570734fdac
3
+ metadata.gz: 59686770a8a0d625f3fdafba40cea1d8d2ea9abf2d9a0e178913d721a2251af5
4
+ data.tar.gz: 47a0d261cda5cd0fb9d7d3f3c453ec5a45e3aedf4581ef8e61483fe6b455dec1
5
5
  SHA512:
6
- metadata.gz: f5db736dc76cab7058b37367e4583872d547c77d467cf068496110c376cfbbe4c93f2109b54fdea6766967f902efd87948cd7370a6bb513a838e086012c3c902
7
- data.tar.gz: 9f0276959a27fcb520d1722eee6ee55cc7f85e6e095ec54306c6a1daa8fdd5b7b24e08c3a1ea67fbdd74cabeba3a7500333f5a3e29676d06ab0b13d187085e1c
6
+ metadata.gz: 12897e2edc96239c057816a94feddc88c8c484a2b5660db4d56b78a22e2864508ca87ca7c4f3231695e133d33f9eb42299303c9356819d88c595678e3eddc7e1
7
+ data.tar.gz: e17c18ba924688fe8606e3019c63f26cab7ba58089ea489c8f1a6fa2afc7e932093192a4e7948233c05d07ee673f2b4ae521d21f59276fffee28c0a4ac8db484
data/Changelog.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Changelog
2
2
 
3
- ## Master
3
+ ## 0.9.1
4
+ - Improve handling database connections when the server kills the connection
4
5
 
5
6
  ## 0.9.0
6
7
  - Handle database reconnection for distributed traces as it might cause some issues with RPCs/synchronous flows
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hermes-rb (0.9.0)
4
+ hermes-rb (0.9.1)
5
5
  activerecord (>= 5)
6
6
  activesupport (>= 5)
7
7
  dry-container (~> 0)
@@ -33,7 +33,7 @@ GEM
33
33
  bundler
34
34
  rake
35
35
  thor (>= 0.14.0)
36
- base64 (0.1.1)
36
+ base64 (0.2.0)
37
37
  bigdecimal (3.1.4)
38
38
  bunny (2.22.0)
39
39
  amq-protocol (~> 2.3, >= 2.3.1)
@@ -45,7 +45,7 @@ GEM
45
45
  ddtrace (0.45.0)
46
46
  msgpack
47
47
  diff-lcs (1.4.4)
48
- drb (2.1.1)
48
+ drb (2.2.0)
49
49
  ruby2_keywords
50
50
  dry-container (0.11.0)
51
51
  concurrent-ruby (~> 1.0)
@@ -80,7 +80,7 @@ GEM
80
80
  minitest (5.20.0)
81
81
  msgpack (1.4.2)
82
82
  multi_json (1.15.0)
83
- mutex_m (0.1.2)
83
+ mutex_m (0.2.0)
84
84
  newrelic_rpm (6.15.0)
85
85
  pg (1.2.3)
86
86
  rack (3.0.8)
@@ -108,7 +108,7 @@ GEM
108
108
  set (~> 1.0)
109
109
  thor (1.2.1)
110
110
  timecop (0.9.2)
111
- timeout (0.4.0)
111
+ timeout (0.4.1)
112
112
  tzinfo (2.0.6)
113
113
  concurrent-ruby (~> 1.0)
114
114
  vcr (5.0.0)
@@ -26,7 +26,12 @@ module Hermes
26
26
  logger.log_enqueued(event_class, body, headers, config.clock.now)
27
27
  else
28
28
  ensure_database_connection!
29
- result = event_processor.call(event_class.to_s, body, headers)
29
+ begin
30
+ result = event_processor.call(event_class.to_s, body, headers)
31
+ rescue StandardError => error
32
+ rescue_from_closed_db_connection(error)
33
+ raise error
34
+ end
30
35
  event = result.event
31
36
  response = result.response
32
37
 
@@ -64,6 +69,13 @@ module Hermes
64
69
  config.database_connection_provider.connection.reconnect! if config.database_connection_provider
65
70
  Hermes::DistributedTrace.connection.reconnect! if config.store_distributed_traces?
66
71
  end
72
+
73
+ def rescue_from_closed_db_connection(error)
74
+ if error.to_s.include?("PG::ConnectionBad")
75
+ config.database_connection_provider.connection_pool.disconnect! if config.database_connection_provider
76
+ Hermes::DistributedTrace.connection_pool.disconnect! if config.store_distributed_traces?
77
+ end
78
+ end
67
79
  end
68
80
 
69
81
  register_consumer(consumer_name, consumer)
@@ -1,5 +1,5 @@
1
1
  module Hermes
2
2
  module Rb
3
- VERSION = "0.9.0"
3
+ VERSION = "0.9.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hermes-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karol Galanciak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-24 00:00:00.000000000 Z
11
+ date: 2023-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-struct