judoscale-ruby 1.13.1 → 1.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/judoscale/adapter_api.rb +2 -2
- data/lib/judoscale/config.rb +10 -6
- data/lib/judoscale/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: 6caa0ab33b7a1b3619b550e988eac92727046cf876aabcd3cb9a6c936c13a44c
|
|
4
|
+
data.tar.gz: bb5928ffa44bd5c2becf32672f310ec128eb90d20fed6dee870cae5d37113d4e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 836a7c518ea2c42148c2698a847fe1b3a5c7cb48131f06c0686fa764ce590010a517ae1dc4934cd2017a9d9c4097416487965e068320c15426ffe6dc58d0e9da
|
|
7
|
+
data.tar.gz: 7152b6fbf6a409307363516da0635c540d16e2f52b489c8e259ec3a3b60994c70340ae6aa75e6cfa68c678a95ee0a961517506aad768a037f0cefcc4950fa933
|
|
@@ -9,7 +9,7 @@ module Judoscale
|
|
|
9
9
|
class AdapterApi
|
|
10
10
|
include Logger
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
MAX_RETRIES = 3
|
|
13
13
|
TRANSIENT_ERRORS = [
|
|
14
14
|
Errno::ECONNREFUSED,
|
|
15
15
|
Errno::ECONNRESET,
|
|
@@ -51,7 +51,7 @@ module Judoscale
|
|
|
51
51
|
else FailureResponse.new([response.code, response.message].join(" - "))
|
|
52
52
|
end
|
|
53
53
|
rescue *TRANSIENT_ERRORS => ex
|
|
54
|
-
if attempts <
|
|
54
|
+
if attempts < MAX_RETRIES
|
|
55
55
|
# TCP timeouts happen sometimes, but they can usually be successfully retried in a moment
|
|
56
56
|
sleep 0.25 * (2**(attempts - 1))
|
|
57
57
|
attempts += 1
|
data/lib/judoscale/config.rb
CHANGED
|
@@ -6,13 +6,14 @@ require "logger"
|
|
|
6
6
|
module Judoscale
|
|
7
7
|
class Config
|
|
8
8
|
class RuntimeContainer < String
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
|
|
9
|
+
# Job metrics are collected from a single container per process type when we
|
|
10
|
+
# can identify the ordinal instance (Heroku "web.2", Scalingo "web-2").
|
|
11
|
+
# Opaque IDs (Render, ECS, Railway, etc.) are always non-redundant.
|
|
12
|
+
ORDINAL_CONTAINER = /\A[a-z_]+[.-](\d{1,3})\z/
|
|
13
|
+
|
|
13
14
|
def redundant_instance?
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
match = match(ORDINAL_CONTAINER)
|
|
16
|
+
match ? match[1].to_i > 1 : false
|
|
16
17
|
end
|
|
17
18
|
end
|
|
18
19
|
|
|
@@ -125,6 +126,9 @@ module Judoscale
|
|
|
125
126
|
RuntimeContainer.new ENV["FLY_MACHINE_ID"]
|
|
126
127
|
elsif ENV.include?("RAILWAY_REPLICA_ID")
|
|
127
128
|
RuntimeContainer.new ENV["RAILWAY_REPLICA_ID"]
|
|
129
|
+
elsif ENV.include?("CONTAINER")
|
|
130
|
+
# Scalingo exposes the container type and index (e.g. "web-1") via CONTAINER.
|
|
131
|
+
RuntimeContainer.new ENV["CONTAINER"]
|
|
128
132
|
else
|
|
129
133
|
# Unsupported platform...
|
|
130
134
|
RuntimeContainer.new("")
|
data/lib/judoscale/version.rb
CHANGED