activerecord_postgresql_retry 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/activerecord_postgresql_retry.rb +7 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 586799be600dd53fba602bc34b16a1046ae631c6
|
4
|
+
data.tar.gz: 25a494e60300a43b15266f517e2b79fa77b1b167
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4281f5fb594662449c483a10f4b55d4de846223656b41f96ee935a6f6eee73c906bf4e580eb204e376de7f2dfa63b84b432fa17995cb47c2ea08515358dabcc1
|
7
|
+
data.tar.gz: 23263e965ffd259485415dcbd53e064539db5d17b9a1811dacac17d0fe37d3f4f43ea86d34777be1ecc464e0a774c8e62308b641a9ffdc6b62d0ffcde08d24b1
|
@@ -42,18 +42,19 @@ module ActiveRecord
|
|
42
42
|
|
43
43
|
begin
|
44
44
|
yield
|
45
|
-
rescue PG::ConnectionBad, PG::UnableToSend, ActiveRecord::StatementInvalid => ex
|
45
|
+
rescue PG::Error, PG::ConnectionBad, PG::UnableToSend, ActiveRecord::StatementInvalid => ex
|
46
|
+
raise unless ex.message =~ /invalid encoding name/ if ex.is_a? PG::Error
|
46
47
|
raise if open_transactions != 0
|
47
48
|
raise if retry_count >= PG_QUERY_RETRY
|
48
|
-
raise
|
49
|
-
|
50
|
-
|
51
|
-
)
|
49
|
+
raise unless (
|
50
|
+
ex.original_exception.is_a?(PG::ConnectionBad) ||
|
51
|
+
ex.original_exception.is_a?(PG::UnableToSend)
|
52
|
+
) if ex.is_a?(ActiveRecord::StatementInvalid) && ex.respond_to?(:original_exception)
|
52
53
|
|
53
54
|
sleep PG_SLEEP_RETRY
|
54
55
|
retry_count += 1
|
55
56
|
$log.warn "PostgreSQL retry ##{retry_count} '#{defined?(sql) ? sql : ''}' because #{ex}"
|
56
|
-
|
57
|
+
old_reconnect! rescue nil
|
57
58
|
retry
|
58
59
|
end
|
59
60
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord_postgresql_retry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandru Szasz
|
@@ -54,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
54
|
version: '0'
|
55
55
|
requirements: []
|
56
56
|
rubyforge_project:
|
57
|
-
rubygems_version: 2.
|
57
|
+
rubygems_version: 2.5.1
|
58
58
|
signing_key:
|
59
59
|
specification_version: 4
|
60
60
|
summary: This gem provides a patch that once included will retry the PostgreSQL operation
|