spree_cm_commissioner 2.8.13 → 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: cd2507fdfcb489044af5b8a7f6fd3905d6b7820e06699491481499efe02fabe8
4
- data.tar.gz: 20905a50da0e184669cc7383b35635898ab9a0134dc26d91516f3eec62985012
3
+ metadata.gz: 400b9f97bf94e87bc297ba238423a80ef7f5b94774a39170c48e809350f24bb3
4
+ data.tar.gz: dade198707fa92ad3c258205d7616187007e865890906419fcbfaaa36b168dbe
5
5
  SHA512:
6
- metadata.gz: d0365e44dbb3c87a2bb62c446210b3396b5a6bebb59f27d703025afc738b87a1bb9dd79af8e2c6dfa14312d51ee60c031c3d7b17ccdc5e48a289bf47f6e351bc
7
- data.tar.gz: 4a0b6cd516e730c37ad87c4cc0fab35d792d0cbab5532f4dd637b52a37cfcc0ea609d4673af80a94a2d6d2cceeba66c671a523d872406f8c409897a6b856d73b
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.13)
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,19 +12,17 @@ module SpreeCmCommissioner
12
12
  @document_data = document.get.data
13
13
  end
14
14
 
15
- def self.compute_max_sessions_count_with_min(server_running_count:, max_thread_count:, multiplier:, cap:)
15
+ def self.compute_max_sessions_count_with_min(server_running_count:, max_thread_count:, multiplier:)
16
16
  min = ENV.fetch('WAITING_ROOM_MIN_SESSIONS_COUNT', '5').to_i
17
17
  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)
18
+ [max, min].max
20
19
  end
21
20
 
22
21
  def max_sessions_count_with_min
23
22
  @max_sessions_count_with_min ||= self.class.compute_max_sessions_count_with_min(
24
23
  server_running_count: server_running_count,
25
24
  max_thread_count: max_thread_count,
26
- multiplier: multiplier,
27
- cap: max_sessions_count_cap
25
+ multiplier: multiplier
28
26
  )
29
27
  end
30
28
 
@@ -43,11 +41,6 @@ module SpreeCmCommissioner
43
41
  document_data[:multiplier]&.to_i || ENV.fetch('WAITING_ROOM_MULTIPLIER', '150').to_i
44
42
  end
45
43
 
46
- # hard ceiling for max_sessions_count to avoid auto-scaling the system too much
47
- def max_sessions_count_cap
48
- document_data[:max_sessions_count_cap]&.to_i || ENV.fetch('WAITING_ROOM_MAX_SESSIONS_COUNT_CAP', '1000').to_i
49
- end
50
-
51
44
  def document
52
45
  @document ||= firestore.col('metadata').doc('system')
53
46
  end
@@ -20,16 +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
- new_data[:max_sessions_count_cap] = [fetcher.max_sessions_count_cap + modify, 1].max
28
-
29
- fetcher.document.set(new_data)
30
- cache_max_sessions_count(new_data)
31
- end
32
-
33
23
  def set(server_running_count:)
34
24
  fetcher.load_document_data
35
25
 
@@ -50,8 +40,7 @@ module SpreeCmCommissioner
50
40
  max = WaitingRoomSystemMetadataFetcher.compute_max_sessions_count_with_min(
51
41
  server_running_count: data[:server_running_count]&.to_i || fetcher.server_running_count,
52
42
  max_thread_count: data[:max_thread_count]&.to_i || fetcher.max_thread_count,
53
- multiplier: data[:multiplier]&.to_i || fetcher.multiplier,
54
- cap: data[:max_sessions_count_cap]&.to_i || fetcher.max_sessions_count_cap
43
+ multiplier: data[:multiplier]&.to_i || fetcher.multiplier
55
44
  )
56
45
  Rails.cache.write('waiting_room/max_sessions_count', max, expires_in: 1.hour)
57
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.13'.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.13
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