rails-autoscale-core 1.2.3 → 1.3.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36c26aeba2eb5413f339a8c1c756632a4299b7c397a05cfbea325c01ee562c28
|
4
|
+
data.tar.gz: '039d32858527abd7b01b804491ed0296b19c77c91216cd7d5eec35b3ad90edf8'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbefb2b2c8f48a7ffd4e6b4b2a51cf4b54c545fae1c5db55d9dff45b3e33338ee34507f2950d7ab7e1a60ba0606957f6b87ec1ccffeaae812a723a2fd9603d98
|
7
|
+
data.tar.gz: f2e0ae3ffd1af3b4afd841b73e3dc17128ee7937a3b5e56a6a20264c1b63b62bf5ea31593458f8595a083990f313402c524c8017b49695ffa3a21bfd4bc70bad
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
judoscale-ruby (1.
|
4
|
+
judoscale-ruby (1.3.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -10,19 +10,19 @@ GEM
|
|
10
10
|
public_suffix (>= 2.0.2, < 6.0)
|
11
11
|
crack (0.4.5)
|
12
12
|
rexml
|
13
|
-
debug (1.
|
14
|
-
irb (>= 1.
|
15
|
-
reline (>= 0.
|
13
|
+
debug (1.7.1)
|
14
|
+
irb (>= 1.5.0)
|
15
|
+
reline (>= 0.3.1)
|
16
16
|
hashdiff (1.0.1)
|
17
|
-
io-console (0.
|
18
|
-
irb (1.
|
17
|
+
io-console (0.6.0)
|
18
|
+
irb (1.6.2)
|
19
19
|
reline (>= 0.3.0)
|
20
|
-
minitest (5.
|
21
|
-
public_suffix (5.0.
|
20
|
+
minitest (5.17.0)
|
21
|
+
public_suffix (5.0.1)
|
22
22
|
rake (13.0.6)
|
23
23
|
rake-release (1.3.0)
|
24
24
|
bundler (>= 1.11, < 3)
|
25
|
-
reline (0.3.
|
25
|
+
reline (0.3.2)
|
26
26
|
io-console (~> 0.5)
|
27
27
|
rexml (3.2.5)
|
28
28
|
webmock (3.18.1)
|
@@ -10,6 +10,13 @@ module Judoscale
|
|
10
10
|
include Logger
|
11
11
|
|
12
12
|
SUCCESS = "success"
|
13
|
+
TRANSIENT_ERRORS = [
|
14
|
+
Errno::ECONNREFUSED,
|
15
|
+
Errno::ECONNRESET,
|
16
|
+
Net::OpenTimeout,
|
17
|
+
Net::ReadTimeout,
|
18
|
+
OpenSSL::SSL::SSLError
|
19
|
+
]
|
13
20
|
|
14
21
|
def initialize(config)
|
15
22
|
@config = config
|
@@ -43,14 +50,14 @@ module Judoscale
|
|
43
50
|
when 200...300 then SuccessResponse.new(response.body)
|
44
51
|
else FailureResponse.new([response.code, response.message].join(" - "))
|
45
52
|
end
|
46
|
-
rescue
|
53
|
+
rescue *TRANSIENT_ERRORS => ex
|
47
54
|
if attempts < 3
|
48
55
|
# TCP timeouts happen sometimes, but they can usually be successfully retried in a moment
|
49
56
|
sleep 0.01
|
50
57
|
attempts += 1
|
51
58
|
retry
|
52
59
|
else
|
53
|
-
FailureResponse.new("
|
60
|
+
FailureResponse.new("Could not connect to #{uri.host}: #{ex.inspect}")
|
54
61
|
end
|
55
62
|
end
|
56
63
|
|
@@ -14,14 +14,18 @@ module Judoscale
|
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
-
def
|
17
|
+
def run_silently(&block)
|
18
18
|
if Config.instance.log_level && ::ActiveRecord::Base.logger.respond_to?(:silence)
|
19
|
-
::ActiveRecord::Base.logger.silence(Config.instance.log_level) {
|
19
|
+
::ActiveRecord::Base.logger.silence(Config.instance.log_level) { yield }
|
20
20
|
else
|
21
|
-
|
21
|
+
yield
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
def select_rows_silently(sql)
|
26
|
+
run_silently { select_rows_tagged(sql) }
|
27
|
+
end
|
28
|
+
|
25
29
|
def select_rows_tagged(sql)
|
26
30
|
if ActiveRecord::Base.logger.respond_to?(:tagged)
|
27
31
|
ActiveRecord::Base.logger.tagged(Config.instance.log_tag) { select_rows(sql) }
|
@@ -18,11 +18,18 @@ module Judoscale
|
|
18
18
|
|
19
19
|
def started_at
|
20
20
|
if @request_start_header
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
|
21
|
+
# There are several variants of this header. We handle these:
|
22
|
+
# - whole milliseconds (Heroku)
|
23
|
+
# - whole nanoseconds (Render)
|
24
|
+
# - fractional seconds (NGINX)
|
25
|
+
# - preceeding "t=" (NGINX)
|
26
|
+
value = @request_start_header.gsub(/[^0-9.]/, "").to_f
|
27
|
+
|
28
|
+
case value
|
29
|
+
when 0..100_000_000_000 then Time.at(value)
|
30
|
+
when 100_000_000_000..100_000_000_000_000 then Time.at(value / 1000.0)
|
31
|
+
else Time.at(value / 1_000_000.0)
|
32
|
+
end
|
26
33
|
end
|
27
34
|
end
|
28
35
|
|
data/lib/judoscale/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-autoscale-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam McCrea
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-03-11 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email:
|