spree_cm_commissioner 2.8.4 → 2.8.5
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/interactors/spree_cm_commissioner/waiting_guests_caller.rb +13 -4
- data/app/jobs/spree_cm_commissioner/waiting_guests_caller_job.rb +1 -1
- data/app/jobs/spree_cm_commissioner/waiting_room/publish_lobby_path_job.rb +1 -1
- data/app/jobs/spree_cm_commissioner/waiting_room/stamp_queue_positions_job.rb +1 -1
- data/app/jobs/spree_cm_commissioner/waiting_room_latest_system_metadata_puller_job.rb +1 -1
- data/lib/spree_cm_commissioner/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6e0eefab5835ceff321c9b4ce873ba5a2aea6f32d7ab13195bf83051d935957e
|
|
4
|
+
data.tar.gz: 62e1cf733e8426992e1bf355a54e0010e48d9fcb09d9bc72313b7dcfada2eca5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1d86efc8f94247aa4aa5d41717dad69cad40411db0f6140cc0f20b9e8b90ef3c040907e03f23b10c04fa357de458fed00ebb822644022db247655c674ccf021d
|
|
7
|
+
data.tar.gz: f91f5e7f163fcc60e716fe5582363720a5842fca70d2b9993dbc2945e13d9eb4db0ae0dd7b1de658fe06b72b021f0e3a65e4011e8292a4c677f38debf886f237
|
data/Gemfile.lock
CHANGED
|
@@ -6,6 +6,9 @@ module SpreeCmCommissioner
|
|
|
6
6
|
MIN_WAIT_TO_ENTER_SECONDS = 120 # 2 min floor — Waiting Room step (full journey, more uncertainty)
|
|
7
7
|
MIN_QUEUE_TO_ENTER_SECONDS = 60 # 1 min floor — Queue step (position assigned, one caller cycle minimum)
|
|
8
8
|
|
|
9
|
+
# Firestore bounds a batch update by payload size (10 MiB); 500 ops/commit leaves us far under that.
|
|
10
|
+
FIRESTORE_BATCH_SIZE = (ENV['WAITING_ROOM_FIRESTORE_BATCH_SIZE'] || 500).to_i
|
|
11
|
+
|
|
9
12
|
def call
|
|
10
13
|
available_slots = fetch_available_slots
|
|
11
14
|
return unless available_slots.positive?
|
|
@@ -70,11 +73,17 @@ module SpreeCmCommissioner
|
|
|
70
73
|
|
|
71
74
|
# For alert waiting guests to enter room, we just update :allow_to_enter_room_at.
|
|
72
75
|
# App will listen to firebase & start refresh session token to enter room.
|
|
76
|
+
#
|
|
77
|
+
# Commit in Firestore batches (chunks of FIRESTORE_BATCH_SIZE) instead of one update per guest,
|
|
78
|
+
# so e.g. 1000 guests = 2 commits, not 1000 round-trips. update merges, so we only send the
|
|
79
|
+
# changed field and leave the rest of each doc intact.
|
|
73
80
|
def calling_all(waiting_guests)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
81
|
+
allow_at = Time.zone.now
|
|
82
|
+
|
|
83
|
+
waiting_guests.each_slice(FIRESTORE_BATCH_SIZE) do |slice|
|
|
84
|
+
firestore.batch do |b|
|
|
85
|
+
slice.each { |document| b.update(document.ref, allow_to_enter_room_at: allow_at) }
|
|
86
|
+
end
|
|
78
87
|
end
|
|
79
88
|
end
|
|
80
89
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# cron: "*/30 * * * *" # Every 30 minute
|
|
3
3
|
# class: "SpreeCmCommissioner::WaitingRoomLatestSystemMetadataPuller"
|
|
4
4
|
module SpreeCmCommissioner
|
|
5
|
-
class WaitingRoomLatestSystemMetadataPullerJob <
|
|
5
|
+
class WaitingRoomLatestSystemMetadataPullerJob < ApplicationUniqueJob
|
|
6
6
|
queue_as :waiting_room
|
|
7
7
|
|
|
8
8
|
def perform
|