Class: SpreeCmCommissioner::WaitingRoomSimulationOperationsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/spree_cm_commissioner/waiting_room_simulation_operations_controller.rb

Overview

The one server-side endpoint the standalone waiting_room_simulation/ CLI needs — everything else it does directly against Firestore with its own service account (seeding, heartbeats, reading frontier/lobby state), and session mint/renew already has a real public endpoint (WaitingRoomSessionsController). This exists only because WaitingRoom::AdvanceQueue is a Ruby class that only exists inside this Rails app, with no equivalent reachable over Firestore.

A machine client with no session, so CSRF protection doesn't apply here the way it does for a browser-originated request — authenticated instead by a shared secret (WAITING_ROOM_SIMULATION_TICK_KEY), same shape as LoadTestBypassable's X-Request-Verify check. Unset key => the endpoint 404s entirely, never a default-open state.

Instance Method Summary collapse

Instance Method Details

#createObject

AdvanceQueue always runs its full sweep+stamp+call sequence — there's only ever one thing this endpoint can ask for, so the response always echoes both results. The response returns before CallGuestsChunkJob finishes writing Firestore — a caller polling for allow_to_enter_room_at needs to wait a beat.



20
21
22
23
24
25
26
27
# File 'app/controllers/spree_cm_commissioner/waiting_room_simulation_operations_controller.rb', line 20

def create
  advance_result = SpreeCmCommissioner::WaitingRoom::AdvanceQueue.call!.value

  render json: {
    stamp: { stamped: advance_result[:stamped] },
    call: { called: true, called_count: advance_result[:called_count] }
  }
end