rails-pg-adapter 0.1.12 → 0.1.13

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: b84b17ac8e8008860499554d460faba310b74cad9ab1121a47ae3546ce07869e
4
- data.tar.gz: f60cd6ef5bd5a9d87ef55d51840d75ae0142ef3c3d86e14aed523784b2147b57
3
+ metadata.gz: ee063dc61ffb7297dd7591706c9cfb816dbbe1a407abf9d997a6c151cab1ad49
4
+ data.tar.gz: f80b24aed7b4c65d73af05cac66d35dd25a0fb7d80f7f5fff9423a833d857745
5
5
  SHA512:
6
- metadata.gz: 7bc8312c2fa2ab807ebcc197b1f3e0e61bc700fe7b451e436c6667470f2df0a7300c773715ea7cc15fac75b0dba322ef67dedcedc135d479a139b1d4ec251ec0
7
- data.tar.gz: dfb8e3d337d0905639f67cfb84101b0bad1232152d838238373b4ac0abca0e5256a174585b8866f424119b157597e5730e0e03a48f14989d67c8c9a92f0e8491
6
+ metadata.gz: 206eedbdd47a2a56a41a4386cb213aded7beeec53e375ec6adb13b116defac8cdfe506e1f989dc511189e8474d072a2776f94dabb2b751ba9576f1dff2e144f7
7
+ data.tar.gz: 716f19553e8f15afae93d099f4e5ec81927d9f7a69f134fc92e97e83aa428bc30ccf7947fa59727db6a0c142de576823ecdda4c022352f8e726bf1bc97f99458
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.1.13] - 2023-05-09
2
+
3
+ - Use throw_away! instead and capture state of transaction and re-raise accordingly
4
+
1
5
  ## [0.1.12] - 2023-05-08
2
6
 
3
7
  - Slight refactor and reduce multiple disconnect attempts
@@ -44,6 +44,7 @@ module RailsPgAdapter
44
44
  def exec_cache(*args)
45
45
  sleep_times = ::RailsPgAdapter.configuration.reconnect_with_backoff.dup
46
46
  query, _ = args
47
+ within_transaction = in_transaction? # capture in_transaction? state before retries
47
48
  begin
48
49
  super(*args)
49
50
  rescue ::ActiveRecord::StatementInvalid,
@@ -52,6 +53,7 @@ module RailsPgAdapter
52
53
  raise unless ::RailsPgAdapter::Patch.supported_errors?(e)
53
54
  handle_schema_cache_error(e)
54
55
  handle_activerecord_error(e)
56
+ raise if within_transaction
55
57
  raise unless try_reconnect?(e)
56
58
 
57
59
  sleep_time = sleep_times.shift
@@ -70,6 +72,7 @@ module RailsPgAdapter
70
72
  def exec_no_cache(*args)
71
73
  sleep_times = ::RailsPgAdapter.configuration.reconnect_with_backoff.dup
72
74
  query, _ = args
75
+ within_transaction = in_transaction? # capture in_transaction? state before retries
73
76
  begin
74
77
  super(*args)
75
78
  rescue ::ActiveRecord::StatementInvalid,
@@ -78,6 +81,7 @@ module RailsPgAdapter
78
81
  raise unless ::RailsPgAdapter::Patch.supported_errors?(e)
79
82
  handle_schema_cache_error(e)
80
83
  handle_activerecord_error(e)
84
+ raise if within_transaction
81
85
  raise unless try_reconnect?(e)
82
86
 
83
87
  sleep_time = sleep_times.shift
@@ -103,7 +107,7 @@ module RailsPgAdapter
103
107
  def handle_activerecord_error(e)
104
108
  return unless ::RailsPgAdapter::Patch.failover_error?(e.message)
105
109
  warn("clearing connections due to #{e} - #{e.message}")
106
- disconnect_conn!
110
+ throw_away!
107
111
  end
108
112
 
109
113
  def handle_schema_cache_error(e)
@@ -114,11 +118,6 @@ module RailsPgAdapter
114
118
  raise(e)
115
119
  end
116
120
 
117
- def disconnect_conn!
118
- disconnect!
119
- ::ActiveRecord::Base.connection_pool.remove(::ActiveRecord::Base.connection)
120
- end
121
-
122
121
  def internal_clear_schema_cache!
123
122
  ::ActiveRecord::Base.connection_pool.connections.each { |conn| conn.schema_cache.clear! }
124
123
  ::ActiveRecord::Base.descendants.each(&:reset_column_information)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsPgAdapter
4
- VERSION = "0.1.12"
4
+ VERSION = "0.1.13"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-pg-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tines Engineering
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-08 00:00:00.000000000 Z
11
+ date: 2023-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails