Background Processes
The Function App runs several background processes on Azure timer triggers. These are not HTTP-callable - they execute on a schedule managed by the Azure Functions runtime.
Garbage collection
Section titled “Garbage collection”Schedule: Every 10 minutes (0 */10 * * * *)
Processes the room-deletion-queue to clean up VMRs after sessions end.
flowchart TD
A[Timer fires] --> B[Pop up to 20 messages from room-deletion-queue]
B --> C{Messages found?}
C -->|No| Z[Exit - nothing to do]
C -->|Yes| D[Fetch all rooms from Pexip]
D --> E[Remove persistent rooms from list]
E --> F{For each queue message}
F --> G{Room exists on Pexip?}
G -->|No| H[Delete orphaned queue message]
G -->|Yes| I{Message older than 10 min?}
I -->|No| J[Skip - too recent]
I -->|Yes| K[Delete room on Pexip]
K --> L[Delete queue message]
H --> F
J --> F
L --> F
Why the 10-minute delay?
Section titled “Why the 10-minute delay?”Pexip sends a conference_ended event when the last participant leaves. However, brief disconnections (network hiccups, page refreshes) can cause a room to appear “ended” momentarily before the participant reconnects. The 10-minute delay prevents premature deletion during these transient states.
Persistent room exclusion
Section titled “Persistent room exclusion”Rooms whose names start with configured prefixes are never garbage-collected:
test_- manual testing roomsvkiosk_- virtual kiosk rooms
Event sink
Section titled “Event sink”Endpoint: POST /public/event_sink (HTTP Basic auth)
Pexip Infinity is configured to send event sink webhooks to this endpoint. The Function App:
- Receives all event types from Pexip
- Filters for
conference_endedevents only - Extracts the room name from
event.data.name(fallback:event.data.conference) - Adds the room name to the
room-deletion-queue
The actual deletion happens via the garbage collection timer (above), not immediately upon event receipt.
Pexip configuration
Section titled “Pexip configuration”On the Pexip Management Node, the event sink is configured under Platform > Event Sinks:
| Setting | Value |
|---|---|
| URL | https://api.vc.maxconf.ca/public/event_sink |
| Authentication | HTTP Basic |
| Username | Stored in Key Vault |
| Password | Stored in Key Vault |
Metrics collection
Section titled “Metrics collection”Schedule: Every 5 minutes (0 */5 * * * *, runs on startup)
Collects operational metrics and writes them to a Log Analytics workspace:
| Metric | Source |
|---|---|
| Queue depth (room-creation-queue) | Azure Storage Queue |
| Available VMRs | Pexip Management API |
| In-use VMRs | Pexip Management API |
| Pexip alarm status | Pexip Management API |
| Pexip connectivity | Pexip Management API |
Room pool management
Section titled “Room pool management”The pre-provisioned room pool is managed through:
- Initial provisioning:
POST /room/bulk/creates rooms up toMAX_VMRand populates the queue - Steady-state replenishment: Each
POST /room/createrequest triggers a background task to create one replacement room - Reset:
DELETE /room/bulk/clears all rooms and the queue (used before reprovisioning)
Queue architecture
Section titled “Queue architecture”graph LR
subgraph "room-creation-queue"
Q1[room_abc123]
Q2[room_def456]
Q3[room_ghi789]
end
subgraph "room-deletion-queue"
D1[room_xyz999]
end
CREATE[POST /room/create] -->|pop| Q1
CREATE -->|push new| Q3
EVENT[Event Sink] -->|push| D1
GC[Garbage Collector] -->|pop| D1