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 +4 -4
- data/Gemfile.lock +1 -1
- data/app/controllers/spree/admin/system/waiting_room_controller.rb +0 -7
- data/app/services/spree_cm_commissioner/waiting_room_system_metadata_fetcher.rb +4 -16
- data/app/services/spree_cm_commissioner/waiting_room_system_metadata_setter.rb +1 -14
- data/app/views/spree/admin/system/waiting_room/show.html.erb +0 -5
- data/config/routes.rb +0 -1
- data/lib/spree_cm_commissioner/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 400b9f97bf94e87bc297ba238423a80ef7f5b94774a39170c48e809350f24bb3
|
|
4
|
+
data.tar.gz: dade198707fa92ad3c258205d7616187007e865890906419fcbfaaa36b168dbe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bf0faa81d8026d4283c6292d40c3c0c60be8d5d5e1e755c9eb03c950fd94de02f262e3946473a45a2b8500355e37781b175c7d425ce5c292d5c59e1fbc316533
|
|
7
|
+
data.tar.gz: dfd7f46061291a7ddce0780aacb82d9e9129c52ec1b01244b6a48cb1a008a1ee339b5c878656dc4e4091d0492c89de627758cd42ff8c8706059d135a1bb604fc
|
data/Gemfile.lock
CHANGED
|
@@ -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.
|
|
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
|
-
|
|
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
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.
|
|
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:
|
|
3485
|
+
version: 1.3.1
|
|
3486
3486
|
requirements:
|
|
3487
3487
|
- none
|
|
3488
3488
|
rubygems_version: 3.4.1
|