fix(stress): port harnesses to v1.2 single-session API + remove WS-batch hang
Local API stress (lib.mjs / api_stress.mjs): - setupSession now does login -> /admin/api/reset and returns sid="main". Drops the dead /admin/api/quizzes + /admin/api/sessions calls left over from the multi-quiz codex era. - bootServer writes the fixture pool (STRESS_POOL by default) to a tmp file and passes QUIZ_POOL_PATH so the v1.2 server has a session at startup. - happyPath: drop the post-connect lobby_update wait (race with snapshot dispatch) and stop double-driving the lifecycle (next() already opens the next question, an explicit open() afterwards is a no-op). - cross_session: rewritten as "cookie not honored on a non-existent sid" since v1.2 hosts a single canonical session. Live accuracy stress (live_accuracy.mjs): - Per-student lobby-snapshot timeout (12s) with WS error/close rejection, so a stalled handshake no longer hangs Promise.all until the outer shell timeout (which produced the exit=124 cycles). - Open all student WSs in parallel (mirrors what real students do); the batch-of-8 throttle was masking the question we wanted answered. - Instructor WS open also bounded by a 15s race so any failure surfaces as actionable error text instead of a silent stall. Bootstrap (deploy/bootstrap.sh): - Stage 1 provisions a 2GB swap file (idempotent) with vm.swappiness=10. 1GB-RAM ECS instances OOM-kill uvicorn under WS-burst start-of-class pressure; swap absorbs the spike without affecting steady state. - Pool seeding prefers examples/demo10_pool.json over the 2-question example so a fresh deploy boots with a usable demo. Pool fixture (examples/demo10_pool.json): - 10-question generic-knowledge demo pool, gitignore exception added.
This commit is contained in:
87
examples/demo10_pool.json
Normal file
87
examples/demo10_pool.json
Normal file
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"title": "Demo Pool: Generic Knowledge (10Q)",
|
||||
"score_fn": "linear_decay",
|
||||
"time_limit_default": 60,
|
||||
"questions": [
|
||||
{
|
||||
"id": "d01",
|
||||
"text": "Which of these is a programming language?",
|
||||
"options": {"A": "HTTP", "B": "Python", "C": "TCP", "D": "DNS"},
|
||||
"correct": "B",
|
||||
"explanation": "Python is a general-purpose programming language; the others are network protocols."
|
||||
},
|
||||
{
|
||||
"id": "d02",
|
||||
"text": "What is 2 + 2?",
|
||||
"options": {"A": "3", "B": "4", "C": "5", "D": "22"},
|
||||
"correct": "B",
|
||||
"explanation": "Basic arithmetic."
|
||||
},
|
||||
{
|
||||
"id": "d03",
|
||||
"text": "What is the capital of France?",
|
||||
"options": {"A": "Berlin", "B": "Madrid", "C": "Paris", "D": "Rome"},
|
||||
"correct": "C",
|
||||
"explanation": "Paris has been the capital of France since the 10th century."
|
||||
},
|
||||
{
|
||||
"id": "d04",
|
||||
"text": "Which planet is known as the Red Planet?",
|
||||
"options": {"A": "Venus", "B": "Mars", "C": "Jupiter", "D": "Saturn"},
|
||||
"correct": "B",
|
||||
"explanation": "Mars appears red because of iron-oxide dust on its surface."
|
||||
},
|
||||
{
|
||||
"id": "d05",
|
||||
"text": "Which HTTP status code means 'Not Found'?",
|
||||
"options": {"A": "200", "B": "301", "C": "404", "D": "500"},
|
||||
"correct": "C",
|
||||
"explanation": "404 is the canonical client-error response for a missing resource."
|
||||
},
|
||||
{
|
||||
"id": "d06",
|
||||
"text": "What does CPU stand for?",
|
||||
"options": {
|
||||
"A": "Central Processing Unit",
|
||||
"B": "Computer Personal Unit",
|
||||
"C": "Central Performance Utility",
|
||||
"D": "Core Programming Unit"
|
||||
},
|
||||
"correct": "A",
|
||||
"explanation": "The CPU is the primary component that executes program instructions."
|
||||
},
|
||||
{
|
||||
"id": "d07",
|
||||
"text": "Which sorting algorithm has the best average-case complexity?",
|
||||
"options": {
|
||||
"A": "Bubble sort",
|
||||
"B": "Selection sort",
|
||||
"C": "Quicksort",
|
||||
"D": "Insertion sort"
|
||||
},
|
||||
"correct": "C",
|
||||
"explanation": "Quicksort averages O(n log n); the others average O(n^2)."
|
||||
},
|
||||
{
|
||||
"id": "d08",
|
||||
"text": "Approximately what is the speed of light in vacuum (m/s)?",
|
||||
"options": {"A": "3 x 10^6", "B": "3 x 10^8", "C": "1.5 x 10^8", "D": "9.8"},
|
||||
"correct": "B",
|
||||
"explanation": "About 299,792,458 m/s, conventionally rounded to 3 x 10^8 m/s."
|
||||
},
|
||||
{
|
||||
"id": "d09",
|
||||
"text": "Which data structure operates strictly in Last-In-First-Out (LIFO) order?",
|
||||
"options": {"A": "Queue", "B": "Stack", "C": "Linked list", "D": "Hash map"},
|
||||
"correct": "B",
|
||||
"explanation": "A stack pushes and pops from the same end."
|
||||
},
|
||||
{
|
||||
"id": "d10",
|
||||
"text": "Which of the following is NOT an operating system?",
|
||||
"options": {"A": "Linux", "B": "Windows", "C": "Oracle", "D": "macOS"},
|
||||
"correct": "C",
|
||||
"explanation": "Oracle is a database management system, not an OS."
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user