spree_cm_commissioner 2.8.12 → 2.8.13
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/Gemfile.lock +1 -1
- data/app/controllers/spree/admin/system/waiting_room_controller.rb +7 -0
- data/app/services/spree_cm_commissioner/waiting_room_system_metadata_fetcher.rb +10 -3
- data/app/services/spree_cm_commissioner/waiting_room_system_metadata_setter.rb +12 -1
- data/app/views/spree/admin/system/waiting_room/show.html.erb +5 -0
- data/config/routes.rb +1 -0
- data/lib/spree_cm_commissioner/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cd2507fdfcb489044af5b8a7f6fd3905d6b7820e06699491481499efe02fabe8
|
|
4
|
+
data.tar.gz: 20905a50da0e184669cc7383b35635898ab9a0134dc26d91516f3eec62985012
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d0365e44dbb3c87a2bb62c446210b3396b5a6bebb59f27d703025afc738b87a1bb9dd79af8e2c6dfa14312d51ee60c031c3d7b17ccdc5e48a289bf47f6e351bc
|
|
7
|
+
data.tar.gz: 4a0b6cd516e730c37ad87c4cc0fab35d792d0cbab5532f4dd637b52a37cfcc0ea609d4673af80a94a2d6d2cceeba66c671a523d872406f8c409897a6b856d73b
|
data/Gemfile.lock
CHANGED
|
@@ -26,6 +26,13 @@ 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
|
+
|
|
29
36
|
def force_pull
|
|
30
37
|
SpreeCmCommissioner::WaitingRoomLatestSystemMetadataPullerJob.perform_now
|
|
31
38
|
SpreeCmCommissioner::WaitingGuestsCallerJob.perform_now
|
|
@@ -12,17 +12,19 @@ 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:)
|
|
15
|
+
def self.compute_max_sessions_count_with_min(server_running_count:, max_thread_count:, multiplier:, cap:)
|
|
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
|
-
|
|
18
|
+
# Cap the auto-scaled value so the system does not scale beyond the configured ceiling.
|
|
19
|
+
max.clamp(min, cap)
|
|
19
20
|
end
|
|
20
21
|
|
|
21
22
|
def max_sessions_count_with_min
|
|
22
23
|
@max_sessions_count_with_min ||= self.class.compute_max_sessions_count_with_min(
|
|
23
24
|
server_running_count: server_running_count,
|
|
24
25
|
max_thread_count: max_thread_count,
|
|
25
|
-
multiplier: multiplier
|
|
26
|
+
multiplier: multiplier,
|
|
27
|
+
cap: max_sessions_count_cap
|
|
26
28
|
)
|
|
27
29
|
end
|
|
28
30
|
|
|
@@ -41,6 +43,11 @@ module SpreeCmCommissioner
|
|
|
41
43
|
document_data[:multiplier]&.to_i || ENV.fetch('WAITING_ROOM_MULTIPLIER', '150').to_i
|
|
42
44
|
end
|
|
43
45
|
|
|
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
|
+
|
|
44
51
|
def document
|
|
45
52
|
@document ||= firestore.col('metadata').doc('system')
|
|
46
53
|
end
|
|
@@ -20,6 +20,16 @@ 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
|
+
|
|
23
33
|
def set(server_running_count:)
|
|
24
34
|
fetcher.load_document_data
|
|
25
35
|
|
|
@@ -40,7 +50,8 @@ module SpreeCmCommissioner
|
|
|
40
50
|
max = WaitingRoomSystemMetadataFetcher.compute_max_sessions_count_with_min(
|
|
41
51
|
server_running_count: data[:server_running_count]&.to_i || fetcher.server_running_count,
|
|
42
52
|
max_thread_count: data[:max_thread_count]&.to_i || fetcher.max_thread_count,
|
|
43
|
-
multiplier: data[:multiplier]&.to_i || fetcher.multiplier
|
|
53
|
+
multiplier: data[:multiplier]&.to_i || fetcher.multiplier,
|
|
54
|
+
cap: data[:max_sessions_count_cap]&.to_i || fetcher.max_sessions_count_cap
|
|
44
55
|
)
|
|
45
56
|
Rails.cache.write('waiting_room/max_sessions_count', max, expires_in: 1.hour)
|
|
46
57
|
end
|
|
@@ -20,6 +20,11 @@
|
|
|
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
|
+
},
|
|
23
28
|
{
|
|
24
29
|
field_name: :active_sesions,
|
|
25
30
|
value: @active_sesions_count,
|
data/config/routes.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_cm_commissioner
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.8.
|
|
4
|
+
version: 2.8.13
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- You
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-06-
|
|
11
|
+
date: 2026-06-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: spree
|