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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/rails_pg_adapter/patch.rb +5 -6
- data/lib/rails_pg_adapter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee063dc61ffb7297dd7591706c9cfb816dbbe1a407abf9d997a6c151cab1ad49
|
4
|
+
data.tar.gz: f80b24aed7b4c65d73af05cac66d35dd25a0fb7d80f7f5fff9423a833d857745
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 206eedbdd47a2a56a41a4386cb213aded7beeec53e375ec6adb13b116defac8cdfe506e1f989dc511189e8474d072a2776f94dabb2b751ba9576f1dff2e144f7
|
7
|
+
data.tar.gz: 716f19553e8f15afae93d099f4e5ec81927d9f7a69f134fc92e97e83aa428bc30ccf7947fa59727db6a0c142de576823ecdda4c022352f8e726bf1bc97f99458
|
data/CHANGELOG.md
CHANGED
@@ -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
|
-
|
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)
|
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.
|
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-
|
11
|
+
date: 2023-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|