rails-pg-adapter 0.1.9 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/rails_pg_adapter/patch.rb +20 -23
- 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: 97170715fde6ba059d296a9fbce17b22b1c0e4a40d48473992d02d8368b96963
|
4
|
+
data.tar.gz: 51099b75bbaaa27a0f8120a865da60da33a21e35b262802843ba29791c8d572f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1458a06466189759dee8b82cea49adbf856cac36937ead93975d47439d4f962033a5a4c01f9bcce871c919a0c7c4341f7b07c62c7c5f882cd98ffde70b685e06
|
7
|
+
data.tar.gz: 563aef7c452bfd98266543597ed5cb2502d2047fe0cd586522bc431aa441b86b799c494a5f4c69f03047a52fba2a5b916dac553160f07976e6b05445e431454c
|
data/CHANGELOG.md
CHANGED
@@ -14,7 +14,8 @@ module RailsPgAdapter
|
|
14
14
|
"connection is closed",
|
15
15
|
"could not connect",
|
16
16
|
"is not currently accepting connections",
|
17
|
-
"too many connections"
|
17
|
+
"too many connections",
|
18
|
+
"Connection refused",
|
18
19
|
].freeze
|
19
20
|
CONNECTION_ERROR_RE = /#{CONNECTION_ERROR.map { |w| Regexp.escape(w) }.join("|")}/.freeze
|
20
21
|
|
@@ -42,6 +43,7 @@ module RailsPgAdapter
|
|
42
43
|
|
43
44
|
def exec_cache(*args)
|
44
45
|
sleep_times = ::RailsPgAdapter.configuration.reconnect_with_backoff.dup
|
46
|
+
query, _ = args
|
45
47
|
begin
|
46
48
|
super(*args)
|
47
49
|
rescue ::ActiveRecord::StatementInvalid,
|
@@ -49,20 +51,19 @@ module RailsPgAdapter
|
|
49
51
|
::ActiveRecord::NoDatabaseError => e
|
50
52
|
raise unless ::RailsPgAdapter::Patch.supported_errors?(e)
|
51
53
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
handle_error(e)
|
60
|
-
end
|
54
|
+
handle_error(e) unless try_reconnect?(e)
|
55
|
+
sleep_time = sleep_times.shift
|
56
|
+
handle_error(e) unless sleep_time
|
57
|
+
warn("Retry query failed, retrying again in #{sleep_time} sec. Retrying: #{query}")
|
58
|
+
sleep(sleep_time)
|
59
|
+
connect
|
60
|
+
retry
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
64
|
def exec_no_cache(*args)
|
65
65
|
sleep_times = ::RailsPgAdapter.configuration.reconnect_with_backoff.dup
|
66
|
+
query, _ = args
|
66
67
|
begin
|
67
68
|
super(*args)
|
68
69
|
rescue ::ActiveRecord::StatementInvalid,
|
@@ -70,15 +71,13 @@ module RailsPgAdapter
|
|
70
71
|
::ActiveRecord::NoDatabaseError => e
|
71
72
|
raise unless ::RailsPgAdapter::Patch.supported_errors?(e)
|
72
73
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
handle_error(e)
|
81
|
-
end
|
74
|
+
handle_error(e) unless try_reconnect?(e)
|
75
|
+
sleep_time = sleep_times.shift
|
76
|
+
handle_error(e) unless sleep_time
|
77
|
+
warn("Retry query failed, retrying again in #{sleep_time} sec. Retrying: #{query}")
|
78
|
+
sleep(sleep_time)
|
79
|
+
connect
|
80
|
+
retry
|
82
81
|
end
|
83
82
|
end
|
84
83
|
|
@@ -99,15 +98,13 @@ module RailsPgAdapter
|
|
99
98
|
if ::RailsPgAdapter::Patch.failover_error?(e.message)
|
100
99
|
warn("clearing connections due to #{e} - #{e.message}")
|
101
100
|
disconnect_conn!
|
102
|
-
raise(e)
|
103
101
|
end
|
104
102
|
|
105
|
-
|
106
|
-
|
103
|
+
raise(e) unless ::RailsPgAdapter::Patch.missing_column_error?(e.message)
|
107
104
|
warn("clearing column information due to #{e} - #{e.message}")
|
108
105
|
|
109
106
|
internal_clear_schema_cache!
|
110
|
-
raise
|
107
|
+
raise(e)
|
111
108
|
end
|
112
109
|
|
113
110
|
def disconnect_conn!
|
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.11
|
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-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|