hermes-rb 0.8.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: 433cc1a9749f827d101d9294283011975311319379d6d074ae721e0b85e2f99f
4
- data.tar.gz: bbec7e7bde055e3bfdc636c036dca46e48e3bd3f9ada9d87cfe7b9ae263f6bc2
3
+ metadata.gz: 59686770a8a0d625f3fdafba40cea1d8d2ea9abf2d9a0e178913d721a2251af5
4
+ data.tar.gz: 47a0d261cda5cd0fb9d7d3f3c453ec5a45e3aedf4581ef8e61483fe6b455dec1
5
5
  SHA512:
6
- metadata.gz: 21a8cad1f51fbdff6104312154a4e9145b9385d005ac8194b1fbba54c28ff1bfb5f75938c359c7617b68b8b41eeb330689472f344c0a303aeb544694794ec4c3
7
- data.tar.gz: 0e725e42455d602480c07160e69039c945c90510e3fe23f2cfdd69fd5dc5e29565a21206307eceaa3a0e84aacd49efdac125d353a855993032ac7fec66a072a0
6
+ metadata.gz: 12897e2edc96239c057816a94feddc88c8c484a2b5660db4d56b78a22e2864508ca87ca7c4f3231695e133d33f9eb42299303c9356819d88c595678e3eddc7e1
7
+ data.tar.gz: e17c18ba924688fe8606e3019c63f26cab7ba58089ea489c8f1a6fa2afc7e932093192a4e7948233c05d07ee673f2b4ae521d21f59276fffee28c0a4ac8db484
data/Changelog.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Changelog
2
2
 
3
- ## Master
3
+ ## 0.9.1
4
+ - Improve handling database connections when the server kills the connection
5
+
6
+ ## 0.9.0
7
+ - Handle database reconnection for distributed traces as it might cause some issues with RPCs/synchronous flows
4
8
 
5
9
  ## 0.8.0
6
10
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hermes-rb (0.8.0)
4
+ hermes-rb (0.9.1)
5
5
  activerecord (>= 5)
6
6
  activesupport (>= 5)
7
7
  dry-container (~> 0)
@@ -12,30 +12,41 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activemodel (7.0.4)
16
- activesupport (= 7.0.4)
17
- activerecord (7.0.4)
18
- activemodel (= 7.0.4)
19
- activesupport (= 7.0.4)
20
- activesupport (7.0.4)
15
+ activemodel (7.1.1)
16
+ activesupport (= 7.1.1)
17
+ activerecord (7.1.1)
18
+ activemodel (= 7.1.1)
19
+ activesupport (= 7.1.1)
20
+ timeout (>= 0.4.0)
21
+ activesupport (7.1.1)
22
+ base64
23
+ bigdecimal
21
24
  concurrent-ruby (~> 1.0, >= 1.0.2)
25
+ connection_pool (>= 2.2.5)
26
+ drb
22
27
  i18n (>= 1.6, < 2)
23
28
  minitest (>= 5.1)
29
+ mutex_m
24
30
  tzinfo (~> 2.0)
25
31
  amq-protocol (2.3.2)
26
32
  appraisal (2.4.1)
27
33
  bundler
28
34
  rake
29
35
  thor (>= 0.14.0)
30
- bunny (2.19.0)
36
+ base64 (0.2.0)
37
+ bigdecimal (3.1.4)
38
+ bunny (2.22.0)
31
39
  amq-protocol (~> 2.3, >= 2.3.1)
32
40
  sorted_set (~> 1, >= 1.0.2)
33
41
  carrot-top (0.0.7)
34
42
  json
35
- concurrent-ruby (1.1.10)
43
+ concurrent-ruby (1.2.2)
44
+ connection_pool (2.4.1)
36
45
  ddtrace (0.45.0)
37
46
  msgpack
38
47
  diff-lcs (1.4.4)
48
+ drb (2.2.0)
49
+ ruby2_keywords
39
50
  dry-container (0.11.0)
40
51
  concurrent-ruby (~> 1.0)
41
52
  dry-core (1.0.0)
@@ -51,29 +62,30 @@ GEM
51
62
  dry-types (>= 1.7, < 2)
52
63
  ice_nine (~> 0.11)
53
64
  zeitwerk (~> 2.6)
54
- dry-types (1.7.0)
65
+ dry-types (1.7.1)
55
66
  concurrent-ruby (~> 1.0)
56
- dry-core (~> 1.0, < 2)
57
- dry-inflector (~> 1.0, < 2)
58
- dry-logic (>= 1.4, < 2)
67
+ dry-core (~> 1.0)
68
+ dry-inflector (~> 1.0)
69
+ dry-logic (~> 1.4)
59
70
  zeitwerk (~> 2.6)
60
- hutch (1.1.1)
71
+ hutch (1.2.0)
61
72
  activesupport (>= 4.2, < 8)
62
73
  bunny (>= 2.19, < 3.0)
63
74
  carrot-top (~> 0.0.7)
64
75
  multi_json (~> 1.15)
65
- i18n (1.12.0)
76
+ i18n (1.14.1)
66
77
  concurrent-ruby (~> 1.0)
67
78
  ice_nine (0.11.2)
68
- json (2.6.2)
69
- minitest (5.16.3)
79
+ json (2.6.3)
80
+ minitest (5.20.0)
70
81
  msgpack (1.4.2)
71
82
  multi_json (1.15.0)
83
+ mutex_m (0.2.0)
72
84
  newrelic_rpm (6.15.0)
73
85
  pg (1.2.3)
74
- rack (3.0.1)
86
+ rack (3.0.8)
75
87
  rake (13.0.1)
76
- rbtree (0.4.5)
88
+ rbtree (0.4.6)
77
89
  request_store (1.5.1)
78
90
  rack (>= 1.4)
79
91
  rspec (3.10.0)
@@ -89,16 +101,18 @@ GEM
89
101
  diff-lcs (>= 1.2.0, < 2.0)
90
102
  rspec-support (~> 3.10.0)
91
103
  rspec-support (3.10.0)
104
+ ruby2_keywords (0.0.5)
92
105
  set (1.0.3)
93
106
  sorted_set (1.0.3)
94
107
  rbtree
95
108
  set (~> 1.0)
96
109
  thor (1.2.1)
97
110
  timecop (0.9.2)
98
- tzinfo (2.0.5)
111
+ timeout (0.4.1)
112
+ tzinfo (2.0.6)
99
113
  concurrent-ruby (~> 1.0)
100
114
  vcr (5.0.0)
101
- zeitwerk (2.6.6)
115
+ zeitwerk (2.6.12)
102
116
 
103
117
  PLATFORMS
104
118
  ruby
data/README.md CHANGED
@@ -295,6 +295,9 @@ end
295
295
  Put this inside `rails_helper`. Note that it requires `webmock` and `sidekiq`.
296
296
 
297
297
  ``` rb
298
+ # This line is needed if you use `database_connection_provider`, otherwise `shared_connection` will be reloaded.
299
+ Hermes.configuration.database_connection_provider = nil
300
+
298
301
  def execute_jobs_inline
299
302
  original_active_job_adapter = ActiveJob::Base.queue_adapter
300
303
  ActiveJob::Base.queue_adapter = :inline
@@ -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
 
@@ -62,6 +67,14 @@ module Hermes
62
67
 
63
68
  def ensure_database_connection!
64
69
  config.database_connection_provider.connection.reconnect! if config.database_connection_provider
70
+ Hermes::DistributedTrace.connection.reconnect! if config.store_distributed_traces?
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
65
78
  end
66
79
  end
67
80
 
@@ -1,5 +1,5 @@
1
1
  module Hermes
2
2
  module Rb
3
- VERSION = "0.8.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.8.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-04-14 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
@@ -307,7 +307,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
307
307
  - !ruby/object:Gem::Version
308
308
  version: '0'
309
309
  requirements: []
310
- rubygems_version: 3.1.4
310
+ rubygems_version: 3.1.6
311
311
  signing_key:
312
312
  specification_version: 4
313
313
  summary: A messenger of gods, delivering them via RabbitMQ with a little help from