mumuki-domain 9.5.0 → 9.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85f8e4d573ce0f6681d4e1924eecdf84e2967a033e3090c4a649f585e7587081
4
- data.tar.gz: c0cc95b03d98873b09c462b34cc69c741b638f04f8fce6f184c28472853449b2
3
+ metadata.gz: 6bf110cfb0548ff83999aba2c18fa8e2647237c764f5475bb7f0543b74d2e573
4
+ data.tar.gz: 06fbf9c04aa1d09579315504ad1f9594581b067f925e88d804632a63d6f36e3d
5
5
  SHA512:
6
- metadata.gz: f92c8f47f514d0d5a38e5ce78dd93745591ce7344758c679439ee60388b5863e64e80b1061572b03c7842792dce189554fe7d986f49130940ad83faf8968bb8d
7
- data.tar.gz: 6fb9c49eb8232748fb02fdb45866583a913c17416071af6de67cdf9cca2013a886d01c1df25035a17c54f09b7158d152312e3526c10355743659145aa9ac8208
6
+ metadata.gz: e398b8225bbc019cf01b72900476a306c32ac4d2f6a4a8522e543c89bf2f641ff9d234efd866b417c59cee8051f2983039379fa32f2f8d45dd1d3152ebabb176
7
+ data.tar.gz: af14215013b827db24006cdff794a5ac0b4aac7229b503abb935d741bf4e10ab6a667a53bb76a36672a88236f1708dd0b4c0d4beb007cdb9b308213d65fb20d4
@@ -103,6 +103,21 @@ class ApplicationRecord < ActiveRecord::Base
103
103
  end
104
104
  end
105
105
 
106
+ def self.with_pg_retry(&block)
107
+ retries ||= 0
108
+ transaction(&block)
109
+ rescue ActiveRecord::StatementInvalid => e
110
+ retries += 1
111
+
112
+ raise e if retries > 2
113
+ if %w(PG::ConnectionBad PG::UnableToSend).any? { |it| e.message.include? it }
114
+ warn "Postgres connection failed. Retrying in 5 seconds..."
115
+ sleep 5
116
+ ActiveRecord::Base.connection.verify!
117
+ retry
118
+ end
119
+ end
120
+
106
121
  def self.numbered(*associations)
107
122
  class_eval do
108
123
  associations.each do |it|
@@ -1,5 +1,5 @@
1
1
  module Mumuki
2
2
  module Domain
3
- VERSION = '9.5.0'
3
+ VERSION = '9.6.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumuki-domain
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.5.0
4
+ version: 9.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-10 00:00:00.000000000 Z
11
+ date: 2021-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails