rails-pg-adapter 0.1.11 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/rails_pg_adapter/patch.rb +32 -25
- data/lib/rails_pg_adapter/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b84b17ac8e8008860499554d460faba310b74cad9ab1121a47ae3546ce07869e
|
4
|
+
data.tar.gz: f60cd6ef5bd5a9d87ef55d51840d75ae0142ef3c3d86e14aed523784b2147b57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bc8312c2fa2ab807ebcc197b1f3e0e61bc700fe7b451e436c6667470f2df0a7300c773715ea7cc15fac75b0dba322ef67dedcedc135d479a139b1d4ec251ec0
|
7
|
+
data.tar.gz: dfb8e3d337d0905639f67cfb84101b0bad1232152d838238373b4ac0abca0e5256a174585b8866f424119b157597e5730e0e03a48f14989d67c8c9a92f0e8491
|
data/CHANGELOG.md
CHANGED
@@ -50,14 +50,20 @@ module RailsPgAdapter
|
|
50
50
|
::ActiveRecord::ConnectionNotEstablished,
|
51
51
|
::ActiveRecord::NoDatabaseError => e
|
52
52
|
raise unless ::RailsPgAdapter::Patch.supported_errors?(e)
|
53
|
+
handle_schema_cache_error(e)
|
54
|
+
handle_activerecord_error(e)
|
55
|
+
raise unless try_reconnect?(e)
|
53
56
|
|
54
|
-
handle_error(e) unless try_reconnect?(e)
|
55
57
|
sleep_time = sleep_times.shift
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
if sleep_time
|
59
|
+
warn("Retry query failed, retrying again in #{sleep_time} sec. Retrying: #{query}")
|
60
|
+
sleep(sleep_time)
|
61
|
+
connect
|
62
|
+
retry
|
63
|
+
else
|
64
|
+
handle_activerecord_error(e)
|
65
|
+
raise
|
66
|
+
end
|
61
67
|
end
|
62
68
|
end
|
63
69
|
|
@@ -70,14 +76,20 @@ module RailsPgAdapter
|
|
70
76
|
::ActiveRecord::ConnectionNotEstablished,
|
71
77
|
::ActiveRecord::NoDatabaseError => e
|
72
78
|
raise unless ::RailsPgAdapter::Patch.supported_errors?(e)
|
79
|
+
handle_schema_cache_error(e)
|
80
|
+
handle_activerecord_error(e)
|
81
|
+
raise unless try_reconnect?(e)
|
73
82
|
|
74
|
-
handle_error(e) unless try_reconnect?(e)
|
75
83
|
sleep_time = sleep_times.shift
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
84
|
+
if sleep_time
|
85
|
+
warn("Retry query failed, retrying again in #{sleep_time} sec. Retrying: #{query}")
|
86
|
+
sleep(sleep_time)
|
87
|
+
connect
|
88
|
+
retry
|
89
|
+
else
|
90
|
+
handle_activerecord_error(e)
|
91
|
+
raise
|
92
|
+
end
|
81
93
|
end
|
82
94
|
end
|
83
95
|
|
@@ -85,22 +97,17 @@ module RailsPgAdapter
|
|
85
97
|
return false if in_transaction?
|
86
98
|
return false unless ::RailsPgAdapter::Patch.failover_error?(e.message)
|
87
99
|
return false unless ::RailsPgAdapter.reconnect_with_backoff?
|
88
|
-
|
89
|
-
begin
|
90
|
-
disconnect_conn!
|
91
|
-
true
|
92
|
-
rescue ::ActiveRecord::ConnectionNotEstablished
|
93
|
-
false
|
94
|
-
end
|
100
|
+
true
|
95
101
|
end
|
96
102
|
|
97
|
-
def
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
103
|
+
def handle_activerecord_error(e)
|
104
|
+
return unless ::RailsPgAdapter::Patch.failover_error?(e.message)
|
105
|
+
warn("clearing connections due to #{e} - #{e.message}")
|
106
|
+
disconnect_conn!
|
107
|
+
end
|
102
108
|
|
103
|
-
|
109
|
+
def handle_schema_cache_error(e)
|
110
|
+
return unless ::RailsPgAdapter::Patch.missing_column_error?(e.message)
|
104
111
|
warn("clearing column information due to #{e} - #{e.message}")
|
105
112
|
|
106
113
|
internal_clear_schema_cache!
|