-
Notifications
You must be signed in to change notification settings - Fork 151
feat: rewrite load test suite #4099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,8 +21,8 @@ const RIVET_RUNNER_TOTAL_SLOTS = process.env.RIVET_RUNNER_TOTAL_SLOTS | |
| : 10000; | ||
| const RIVET_ENDPOINT = process.env.RIVET_ENDPOINT ?? "http://127.0.0.1:6420"; | ||
| const RIVET_TOKEN = process.env.RIVET_TOKEN ?? "dev"; | ||
| const AUTOSTART_SERVER = process.env.NO_AUTOSTART_SERVER === undefined; | ||
| const AUTOSTART_RUNNER = process.env.NO_AUTOSTART_RUNNER === undefined; | ||
| const AUTOSTART_SERVER = process.env.DISABLE_SERVER === undefined; | ||
| const AUTOSTART_RUNNER = process.env.AUTOSTART_RUNNER !== undefined; | ||
|
|
||
| const runnerStarted = Promise.withResolvers<Runner>(); | ||
| const runnerStopped = Promise.withResolvers<Runner>(); | ||
|
|
@@ -78,7 +78,9 @@ app.get("/shutdown", async (c) => { | |
|
|
||
| app.get("/start", async (c) => { | ||
| return streamSSE(c, async (stream) => { | ||
| runner = await startRunner(runnerStarted, runnerStopped); | ||
| const runnerStarted = Promise.withResolvers<Runner>(); | ||
| const runnerStopped = Promise.withResolvers<Runner>(); | ||
| const runner = await startRunner(runnerStarted, runnerStopped); | ||
|
|
||
| c.req.raw.signal.addEventListener("abort", () => { | ||
| getLogger().debug("SSE aborted, shutting down runner"); | ||
|
|
@@ -93,6 +95,13 @@ app.get("/start", async (c) => { | |
| }); | ||
| }); | ||
|
|
||
| app.get("/metadata", async (c) => { | ||
| return c.json({ | ||
| runtime: "test-runner", | ||
| version: "1", | ||
| }); | ||
| }); | ||
|
|
||
| if (AUTOSTART_SERVER) { | ||
| serve({ | ||
| fetch: app.fetch, | ||
|
|
@@ -107,7 +116,24 @@ if (AUTOSTART_RUNNER) { | |
| runner = await startRunner(runnerStarted, runnerStopped); | ||
| } else await autoConfigureServerless(); | ||
|
|
||
| process.on("SIGTERM", async () => { | ||
| getLogger().debug("received SIGTERM, force exiting in 3s"); | ||
|
|
||
| await new Promise(res => setTimeout(res, 3000)); | ||
|
|
||
| process.exit(0); | ||
| }); | ||
| process.on("SIGINT", async () => { | ||
| getLogger().debug("received SIGTERM, force exiting in 3s"); | ||
|
|
||
| await new Promise(res => setTimeout(res, 3000)); | ||
|
|
||
| process.exit(0); | ||
| }); | ||
|
Comment on lines
+119
to
+132
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These signal handlers contain unhandled promises. Since Node.js event handlers don't wait for async functions to complete, these create 'floating promises'. Fix by either removing the async keyword and using setTimeout with a callback, or add .catch() handlers to properly handle errors. Spotted by Graphite Agent (based on CI logs) |
||
|
|
||
| async function autoConfigureServerless() { | ||
| getLogger().info("Configuring serverless"); | ||
|
|
||
| const res = await fetch( | ||
| `http://127.0.0.1:6420/runner-configs/${RIVET_RUNNER_NAME}?namespace=${RIVET_NAMESPACE}`, | ||
| { | ||
|
|
@@ -158,7 +184,7 @@ async function startRunner( | |
| onConnected: () => { | ||
| runnerStarted.resolve(runner); | ||
| }, | ||
| onDisconnected: () => {}, | ||
| onDisconnected: () => { }, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent formatting with extra space after the empty function body. This should be formatted as 'onDisconnected: () => {}' to match the code style used elsewhere. Spotted by Graphite Agent (based on CI logs) |
||
| onShutdown: () => { | ||
| runnerStopped.resolve(runner); | ||
| }, | ||
|
|
||
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy-paste error in SIGINT handler log message. It says "received SIGTERM" but should say "received SIGINT".
Spotted by Graphite Agent

Is this helpful? React 👍 or 👎 to let us know.