Skip to content

Avoid duplicate request handling after server restarts - #229

Open
xiehuanyi wants to merge 1 commit into
lukeed:mainfrom
xiehuanyi:fix/single-listen-handler
Open

xiehuanyi wants to merge 1 commit into
lukeed:mainfrom
xiehuanyi:fix/single-listen-handler

Conversation

@xiehuanyi

Copy link
Copy Markdown

Closing a Polka server and calling .listen() again attaches the same request handler twice. An asynchronous route then runs twice for one HTTP request, duplicating its work.

Attach the handler only when it is not already registered on the server. Add a real HTTP restart regression that checks one route invocation, a valid response, and preservation of a separate request listener.

Validation: the regression records two route invocations before the fix (345 assertions pass, one fails). The complete Tape suite passes all 346 assertions on Node 8.17, 10.24, and 12.22, run sequentially to avoid the existing shared test output file. git diff --check passes. This branch is based on main and does not include #228.

AI disclosure: OpenAI Codex assisted with investigation, implementation, and validation.

Copilot AI balanced review requested due to automatic review settings October 11, 2026 07:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants