dns_one 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dns_one/backend/db.rb +14 -3
- data/lib/dns_one/core_extensions.rb +1 -1
- data/lib/dns_one/log.rb +1 -1
- data/lib/dns_one/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe691ff0349ad58c63129e862519a0d84d8f4852
|
4
|
+
data.tar.gz: 0d1f0f95be34b2df29972ecff4b6d7346b9f6436
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10a2eb9252bb99d2f76faee91885ad001dc182be34bbfd9caa72c1b23df52c821e8f686bd4bc7fd852b1d7c12f18c42c9c18e08fa9afea0e2775693e0488b72b
|
7
|
+
data.tar.gz: 936a963fd822a20bb4994fab7770bb7a396fe30e066e494de356ae6719b85a4807ecb67cee7fbabc3488a2d8efdfd1ed6d0082036865e7275eda421a5c1a6212
|
data/lib/dns_one/backend/db.rb
CHANGED
@@ -5,17 +5,28 @@ module Backend; class DB
|
|
5
5
|
setup_db
|
6
6
|
end
|
7
7
|
|
8
|
-
def find dom_name
|
9
|
-
|
10
|
-
|
8
|
+
def find dom_name, tries = 1
|
9
|
+
return if tries > 3
|
10
|
+
|
11
11
|
res = nil
|
12
|
+
|
12
13
|
begin
|
14
|
+
# http://jakeyesbeck.com/2016/02/14/ruby-threads-and-active-record-connections/
|
13
15
|
ActiveRecord::Base.connection_pool.with_connection do
|
16
|
+
sql = build_query dom_name
|
14
17
|
res = ActiveRecord::Base.connection.execute sql
|
15
18
|
end
|
19
|
+
|
20
|
+
rescue ActiveRecord::StatementInvalid => e
|
21
|
+
Log.e "Query error. Trying to reconnect. Details:\n#{e.desc}"
|
22
|
+
# http://geoff.evason.name/2015/01/18/postgres-ssl-connection-has-been-closed-unexpectedly
|
23
|
+
ActiveRecord::Base.connection.reconnect!
|
24
|
+
find dom_name, (tries+1)
|
25
|
+
|
16
26
|
rescue => e
|
17
27
|
Log.exc e
|
18
28
|
end
|
29
|
+
|
19
30
|
first_record = res&.first
|
20
31
|
record_values = first_record&.values
|
21
32
|
record_values&.first
|
data/lib/dns_one/log.rb
CHANGED
data/lib/dns_one/version.rb
CHANGED