spree_cm_commissioner 2.8.13 → 2.8.14

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd2507fdfcb489044af5b8a7f6fd3905d6b7820e06699491481499efe02fabe8
4
- data.tar.gz: 20905a50da0e184669cc7383b35635898ab9a0134dc26d91516f3eec62985012
3
+ metadata.gz: 1c9db9328cb88cf7fde16a7e685701308b1f7b939ed963d7ee589033a1c38a6e
4
+ data.tar.gz: b43d69cdc29b8550301afcc5a01ab8da004261fc4bc4314019525b36d6f8ca27
5
5
  SHA512:
6
- metadata.gz: d0365e44dbb3c87a2bb62c446210b3396b5a6bebb59f27d703025afc738b87a1bb9dd79af8e2c6dfa14312d51ee60c031c3d7b17ccdc5e48a289bf47f6e351bc
7
- data.tar.gz: 4a0b6cd516e730c37ad87c4cc0fab35d792d0cbab5532f4dd637b52a37cfcc0ea609d4673af80a94a2d6d2cceeba66c671a523d872406f8c409897a6b856d73b
6
+ metadata.gz: aa15d9ee3abd52045750066949564ce695a44744750f5de0087de5fefedff5dc0117c23a44541da7ba169d995454aa6366008c57776c37198e915e755b866220
7
+ data.tar.gz: db7d35fe794708874feccc997084b00565e42c053963d7bf32fa135be05c625eeff8390ccce4a8e9c747acbd74694fc682a05313e6edb41639678b4fe8fc32c7
data/Gemfile.lock CHANGED
@@ -34,7 +34,7 @@ GIT
34
34
  PATH
35
35
  remote: .
36
36
  specs:
37
- spree_cm_commissioner (2.8.13)
37
+ spree_cm_commissioner (2.8.14)
38
38
  activerecord-multi-tenant
39
39
  activerecord_json_validator (~> 2.1, >= 2.1.3)
40
40
  aws-sdk-cloudfront
@@ -12,11 +12,16 @@ module SpreeCmCommissioner
12
12
  @document_data = document.get.data
13
13
  end
14
14
 
15
+ def self.min_sessions_count
16
+ ENV.fetch('WAITING_ROOM_MIN_SESSIONS_COUNT', '5').to_i
17
+ end
18
+
15
19
  def self.compute_max_sessions_count_with_min(server_running_count:, max_thread_count:, multiplier:, cap:)
16
- min = ENV.fetch('WAITING_ROOM_MIN_SESSIONS_COUNT', '5').to_i
20
+ min = min_sessions_count
17
21
  max = server_running_count * max_thread_count * multiplier / 100
18
- # Cap the auto-scaled value so the system does not scale beyond the configured ceiling.
19
- max.clamp(min, cap)
22
+ # Cap the auto-scaled value so the system does not scale beyond the configured ceiling,
23
+ # while ensuring the minimum always wins even if the cap is set below it.
24
+ max.clamp(min, [cap, min].max)
20
25
  end
21
26
 
22
27
  def max_sessions_count_with_min
@@ -24,7 +24,9 @@ module SpreeCmCommissioner
24
24
  fetcher.load_document_data
25
25
 
26
26
  new_data = fetcher.document_data.dup
27
- new_data[:max_sessions_count_cap] = [fetcher.max_sessions_count_cap + modify, 1].max
27
+ # Floor the cap at the configured minimum; a cap below the min is meaningless
28
+ # since the min always wins in compute_max_sessions_count_with_min.
29
+ new_data[:max_sessions_count_cap] = [fetcher.max_sessions_count_cap + modify, WaitingRoomSystemMetadataFetcher.min_sessions_count].max
28
30
 
29
31
  fetcher.document.set(new_data)
30
32
  cache_max_sessions_count(new_data)
@@ -1,5 +1,5 @@
1
1
  module SpreeCmCommissioner
2
- VERSION = '2.8.13'.freeze
2
+ VERSION = '2.8.14'.freeze
3
3
 
4
4
  module_function
5
5
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_cm_commissioner
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.13
4
+ version: 2.8.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - You