rails-autoscale-core 1.0.0 → 1.0.2

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: 957a594b6d2686be815ed71d6c84ffcc92e14a14f5a9035fb12f92d6f979a400
4
- data.tar.gz: b8cb713fb2731acbc11724097425d497c1f48e5bacaeff5cc41410a8b031f0a3
3
+ metadata.gz: aee422dd28d9be5b869c0aa3d5785bb5781ad382b7a287f8ea16ce3735d9b74d
4
+ data.tar.gz: b2c84f8fc3bf71310fa5e3f398867ed739d99da9245bb5b7ee9803a5c28e366e
5
5
  SHA512:
6
- metadata.gz: 4b79400a71ac5f68401be26efa1bcc9e723b37d55c23802fb0ec30a9d1963bc892ac7b0c8067f11cddc802ffbd3dffd2cc80d7895ab7a1be89d0a7aebcff5232
7
- data.tar.gz: f8940544874532959ae2ab3d5405c7087023a742a4f2a365d6ae4a2b15a602e6a41f9c6862d3171b55e4000e7c08008d37781f77531c0c492ea69c926a0377c1
6
+ metadata.gz: bf54f54c24a60f12fe490f3ea61aedecce976563f820d66c16e17cd2ce48004b2a244f43838e7167a9cbce0aaf3d51dc18a413908decdba1bb5443d1eae545fe
7
+ data.tar.gz: 4372cf6b1ef1bedf5004f9017956a6a3e7c67b99d93d569b5ac8c6a5af8cfeb796accdd582198bbf72685ba645287b17f06b82cf16f966a56bba85ac3f18e017
data/Gemfile CHANGED
@@ -5,3 +5,4 @@ gemspec
5
5
  gem "rake", ">= 12.3.3"
6
6
  gem "minitest"
7
7
  gem "webmock"
8
+ gem "debug"
data/Gemfile.lock CHANGED
@@ -1,21 +1,29 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails-autoscale-core (1.0.0)
4
+ rails-autoscale-core (1.0.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- addressable (2.8.0)
10
- public_suffix (>= 2.0.2, < 5.0)
9
+ addressable (2.8.1)
10
+ public_suffix (>= 2.0.2, < 6.0)
11
11
  crack (0.4.5)
12
12
  rexml
13
+ debug (1.4.0)
14
+ irb (>= 1.3.6)
15
+ reline (>= 0.2.7)
13
16
  hashdiff (1.0.1)
17
+ io-console (0.5.11)
18
+ irb (1.4.1)
19
+ reline (>= 0.3.0)
14
20
  minitest (5.15.0)
15
- public_suffix (4.0.6)
21
+ public_suffix (5.0.0)
16
22
  rake (13.0.6)
23
+ reline (0.3.1)
24
+ io-console (~> 0.5)
17
25
  rexml (3.2.5)
18
- webmock (3.14.0)
26
+ webmock (3.18.1)
19
27
  addressable (>= 2.8.0)
20
28
  crack (>= 0.3.2)
21
29
  hashdiff (>= 0.4.0, < 2.0.0)
@@ -27,6 +35,7 @@ PLATFORMS
27
35
  x86_64-linux
28
36
 
29
37
  DEPENDENCIES
38
+ debug
30
39
  minitest
31
40
  rails-autoscale-core!
32
41
  rake (>= 12.3.3)
@@ -27,6 +27,7 @@ module RailsAutoscale
27
27
  end
28
28
 
29
29
  def post_raw(options)
30
+ attempts ||= 1
30
31
  uri = URI.parse("#{@config.api_base_url}#{options.fetch(:path)}")
31
32
  ssl = uri.scheme == "https"
32
33
 
@@ -42,6 +43,15 @@ module RailsAutoscale
42
43
  when 200...300 then SuccessResponse.new(response.body)
43
44
  else FailureResponse.new([response.code, response.message].join(" - "))
44
45
  end
46
+ rescue Net::OpenTimeout
47
+ if attempts < 3
48
+ # TCP timeouts happen sometimes, but they can usually be successfully retried in a moment
49
+ sleep 0.01
50
+ attempts += 1
51
+ retry
52
+ else
53
+ FailureResponse.new("Timeout while obtaining TCP connection to #{uri.host}")
54
+ end
45
55
  end
46
56
 
47
57
  class SuccessResponse < Struct.new(:body)
@@ -31,10 +31,12 @@ module RailsAutoscale
31
31
 
32
32
  def reset
33
33
  @enabled = true
34
- @max_queues = 20
35
34
  @queues = []
36
35
  @queue_filter = DEFAULT_QUEUE_FILTER
37
- @track_busy_jobs = false
36
+
37
+ # Support for deprecated legacy env var configs.
38
+ @max_queues = (ENV["RAILS_AUTOSCALE_MAX_QUEUES"] || 20).to_i
39
+ @track_busy_jobs = ENV["RAILS_AUTOSCALE_LONG_JOBS"] == "true"
38
40
  end
39
41
 
40
42
  def as_json
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsAutoscale
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.2"
5
5
  end
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.0.0
4
+ version: 1.0.2
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: 2022-09-07 00:00:00.000000000 Z
12
+ date: 2022-09-26 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: