Class: SpreeCmCommissioner::WaitingRoom::StampQueuePositions

Inherits:
Object
  • Object
show all
Extended by:
ServiceModuleThrowable
Includes:
Spree::ServiceModule::Base
Defined in:
app/services/spree_cm_commissioner/waiting_room/stamp_queue_positions.rb

Overview

Stamps queue positions onto waiting-guest Firestore docs so the app can render each guest’s place in line and a forward-only progress bar. Walks the day partitions oldest-first, assigning a continuous global position (1, 2, 3, …) capped at STAMP_LIMIT, and commits in Firestore batches to stay under the 10 MiB/commit payload bound.

Constant Summary collapse

STAMP_LIMIT =
(ENV['WAITING_ROOM_POSITION_STAMP_LIMIT'] || 1000).to_i
FIRESTORE_BATCH_SIZE =

Firestore bounds a batch update by payload size (10 MiB); this batch size leaves 500/commit far under that.

(ENV['WAITING_ROOM_FIRESTORE_BATCH_SIZE'] || 500).to_i

Instance Method Summary collapse

Methods included from ServiceModuleThrowable

call!

Instance Method Details

#callObject



18
19
20
21
22
23
# File 'app/services/spree_cm_commissioner/waiting_room/stamp_queue_positions.rb', line 18

def call
  stamp_positions
  success(stamped: @stamped.to_i)
rescue StandardError => e
  failure(nil, e.message)
end