-
-
Notifications
You must be signed in to change notification settings - Fork 87
fix(selfhost): improve orb-relay-drain robustness against broker degradation #3929
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 |
|---|---|---|
|
|
@@ -1005,30 +1005,37 @@ | |
| // same WEBHOOKS lane the push receiver uses. | ||
| if (process.env.ORB_RELAY_MODE === "pull" && process.env.ORB_ENROLLMENT_SECRET && relayDrainState) { | ||
| const { drainOrbRelay } = await import("./orb/broker-client"); | ||
| let drainInFlight = false; | ||
| const { enqueueWebhookByEnv } = await import("./github/webhook"); | ||
| /* v8 ignore start -- pull-mode relay loop is a live self-host timer; monitor semantics are covered in selfhost tests. */ | ||
| const drainRelay = async (): Promise<void> => { | ||
| await drainOrbRelayWithMonitor({ | ||
| state: relayDrainState, | ||
| relayEnv: { | ||
| ORB_ENROLLMENT_SECRET: process.env.ORB_ENROLLMENT_SECRET, | ||
| ORB_BROKER_URL: process.env.ORB_BROKER_URL, | ||
| }, | ||
| env, | ||
| drain: drainOrbRelay, | ||
| if (drainInFlight) return; | ||
|
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.
Removed drainRelay function wrapper, leaving drain logic orphaned and the loop broken. Restore the drainRelay async function wrapper around the drain logic. AI prompt |
||
| drainInFlight = true; | ||
| try { | ||
| await drainOrbRelayWithMonitor({ | ||
| state: relayDrainState, | ||
| relayEnv: { | ||
| ORB_ENROLLMENT_SECRET: process.env.ORB_ENROLLMENT_SECRET, | ||
| ORB_BROKER_URL: process.env.ORB_BROKER_URL, | ||
| }, | ||
| env, | ||
| drain: drainOrbRelay, | ||
| enqueue: enqueueWebhookByEnv, | ||
| }); | ||
| } finally { | ||
| drainInFlight = false; | ||
| } | ||
| enqueue: enqueueWebhookByEnv, | ||
| }); | ||
|
Check failure on line 1027 in src/server.ts
|
||
| }; | ||
| void drainRelay(); | ||
| setInterval( | ||
| () => | ||
| void drainRelay().catch((error) => | ||
| captureError(error, { kind: "orb_relay_drain" }), | ||
| 30_000, | ||
|
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.
Replaced captureError with a no-op literal, silently swallowing drain loop errors. Restore the captureError call to preserve monitoring of drain failures. AI prompt |
||
| ), | ||
| 15_000, | ||
| ); | ||
| /* v8 ignore stop */ | ||
| } | ||
|
|
||
| // Graceful shutdown: stop accepting HTTP, let the queue finish, close the backend. | ||
| let shuttingDown = false; | ||
|
|
@@ -1046,7 +1053,7 @@ | |
| }; | ||
| process.on("SIGTERM", () => void shutdown("SIGTERM")); | ||
| process.on("SIGINT", () => void shutdown("SIGINT")); | ||
| } | ||
|
|
||
| main().catch((error) => { | ||
| captureError(error, { kind: "boot" }); | ||
|
|
||
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.
Removed authorization header from broker API fetch call, leaving request unauthenticated.
Restore the
headerswith the Bearer token and update only the timeout value.AI prompt