spree_cm_commissioner 2.8.14 → 2.8.15.pre.pre1

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: 1c9db9328cb88cf7fde16a7e685701308b1f7b939ed963d7ee589033a1c38a6e
4
- data.tar.gz: b43d69cdc29b8550301afcc5a01ab8da004261fc4bc4314019525b36d6f8ca27
3
+ metadata.gz: 400b9f97bf94e87bc297ba238423a80ef7f5b94774a39170c48e809350f24bb3
4
+ data.tar.gz: dade198707fa92ad3c258205d7616187007e865890906419fcbfaaa36b168dbe
5
5
  SHA512:
6
- metadata.gz: aa15d9ee3abd52045750066949564ce695a44744750f5de0087de5fefedff5dc0117c23a44541da7ba169d995454aa6366008c57776c37198e915e755b866220
7
- data.tar.gz: db7d35fe794708874feccc997084b00565e42c053963d7bf32fa135be05c625eeff8390ccce4a8e9c747acbd74694fc682a05313e6edb41639678b4fe8fc32c7
6
+ metadata.gz: bf0faa81d8026d4283c6292d40c3c0c60be8d5d5e1e755c9eb03c950fd94de02f262e3946473a45a2b8500355e37781b175c7d425ce5c292d5c59e1fbc316533
7
+ data.tar.gz: dfd7f46061291a7ddce0780aacb82d9e9129c52ec1b01244b6a48cb1a008a1ee339b5c878656dc4e4091d0492c89de627758cd42ff8c8706059d135a1bb604fc
data/Gemfile.lock CHANGED
@@ -34,7 +34,7 @@ GIT
34
34
  PATH
35
35
  remote: .
36
36
  specs:
37
- spree_cm_commissioner (2.8.14)
37
+ spree_cm_commissioner (2.8.15.pre.pre1)
38
38
  activerecord-multi-tenant
39
39
  activerecord_json_validator (~> 2.1, >= 2.1.3)
40
40
  aws-sdk-cloudfront
@@ -26,13 +26,6 @@ module Spree
26
26
  redirect_back fallback_location: admin_system_waiting_room_path
27
27
  end
28
28
 
29
- def modify_max_sessions_count_cap
30
- modifier = params[:max_sessions_count_cap]&.to_i || 0
31
- SpreeCmCommissioner::WaitingRoomSystemMetadataSetter.new.modify_max_sessions_count_cap(modifier)
32
-
33
- redirect_back fallback_location: admin_system_waiting_room_path
34
- end
35
-
36
29
  def force_pull
37
30
  SpreeCmCommissioner::WaitingRoomLatestSystemMetadataPullerJob.perform_now
38
31
  SpreeCmCommissioner::WaitingGuestsCallerJob.perform_now
@@ -12,24 +12,17 @@ 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
-
19
- def self.compute_max_sessions_count_with_min(server_running_count:, max_thread_count:, multiplier:, cap:)
20
- min = min_sessions_count
15
+ def self.compute_max_sessions_count_with_min(server_running_count:, max_thread_count:, multiplier:)
16
+ min = ENV.fetch('WAITING_ROOM_MIN_SESSIONS_COUNT', '5').to_i
21
17
  max = server_running_count * max_thread_count * multiplier / 100
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)
18
+ [max, min].max
25
19
  end
26
20
 
27
21
  def max_sessions_count_with_min
28
22
  @max_sessions_count_with_min ||= self.class.compute_max_sessions_count_with_min(
29
23
  server_running_count: server_running_count,
30
24
  max_thread_count: max_thread_count,
31
- multiplier: multiplier,
32
- cap: max_sessions_count_cap
25
+ multiplier: multiplier
33
26
  )
34
27
  end
35
28
 
@@ -48,11 +41,6 @@ module SpreeCmCommissioner
48
41
  document_data[:multiplier]&.to_i || ENV.fetch('WAITING_ROOM_MULTIPLIER', '150').to_i
49
42
  end
50
43
 
51
- # hard ceiling for max_sessions_count to avoid auto-scaling the system too much
52
- def max_sessions_count_cap
53
- document_data[:max_sessions_count_cap]&.to_i || ENV.fetch('WAITING_ROOM_MAX_SESSIONS_COUNT_CAP', '1000').to_i
54
- end
55
-
56
44
  def document
57
45
  @document ||= firestore.col('metadata').doc('system')
58
46
  end
@@ -20,18 +20,6 @@ module SpreeCmCommissioner
20
20
  cache_max_sessions_count(new_data)
21
21
  end
22
22
 
23
- def modify_max_sessions_count_cap(modify)
24
- fetcher.load_document_data
25
-
26
- new_data = fetcher.document_data.dup
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
30
-
31
- fetcher.document.set(new_data)
32
- cache_max_sessions_count(new_data)
33
- end
34
-
35
23
  def set(server_running_count:)
36
24
  fetcher.load_document_data
37
25
 
@@ -52,8 +40,7 @@ module SpreeCmCommissioner
52
40
  max = WaitingRoomSystemMetadataFetcher.compute_max_sessions_count_with_min(
53
41
  server_running_count: data[:server_running_count]&.to_i || fetcher.server_running_count,
54
42
  max_thread_count: data[:max_thread_count]&.to_i || fetcher.max_thread_count,
55
- multiplier: data[:multiplier]&.to_i || fetcher.multiplier,
56
- cap: data[:max_sessions_count_cap]&.to_i || fetcher.max_sessions_count_cap
43
+ multiplier: data[:multiplier]&.to_i || fetcher.multiplier
57
44
  )
58
45
  Rails.cache.write('waiting_room/max_sessions_count', max, expires_in: 1.hour)
59
46
  end
@@ -20,11 +20,6 @@
20
20
  field_name: :max_sessions,
21
21
  value: @fetcher.max_sessions_count_with_min,
22
22
  },
23
- {
24
- field_name: :max_sessions_count_cap,
25
- value: @fetcher.max_sessions_count_cap,
26
- modify_path: modify_max_sessions_count_cap_admin_system_waiting_room_path
27
- },
28
23
  {
29
24
  field_name: :active_sesions,
30
25
  value: @active_sesions_count,
data/config/routes.rb CHANGED
@@ -17,7 +17,6 @@ Spree::Core::Engine.add_routes do
17
17
  post :publish_lobby_path
18
18
  post :modify_multiplier
19
19
  post :modify_max_thread_count
20
- post :modify_max_sessions_count_cap
21
20
  end
22
21
  end
23
22
 
@@ -1,5 +1,5 @@
1
1
  module SpreeCmCommissioner
2
- VERSION = '2.8.14'.freeze
2
+ VERSION = '2.8.15.pre.pre1'.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.14
4
+ version: 2.8.15.pre.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - You
@@ -3480,9 +3480,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
3480
3480
  version: '2.7'
3481
3481
  required_rubygems_version: !ruby/object:Gem::Requirement
3482
3482
  requirements:
3483
- - - ">="
3483
+ - - ">"
3484
3484
  - !ruby/object:Gem::Version
3485
- version: '0'
3485
+ version: 1.3.1
3486
3486
  requirements:
3487
3487
  - none
3488
3488
  rubygems_version: 3.4.1