fix(server): keep slow searches alive - #60
Merged
Conversation
Configure Bun server idle timeouts so database-backed search requests can complete beyond Bun default 10 seconds without resetting the ALB connection. Agent: agent-ea
Contributor
Author
|
[REVIEW] GO — #60 @ 5a7e929 — lens: correctness+security+gates, reviewer unresolved-account002 (1 of 1) Reviewed the exact candidate against fetched base What I read:
Commands and gates:
Blocking P0/P1 findings: none. The new environment value is validated before server startup, invalid or out-of-range values fail closed, and the default is passed through the shared REST/MCP HTTP server factory without changing authentication or data-handling paths. Non-blocking follow-ups: none. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bun.servewith a 60-second idle timeout instead of inheriting Bun's 10-second defaultHASNA_SESSIONS_IDLE_TIMEOUT_SECONDSoverrides from 0 through 255 secondsRoot cause
ALB access logs for the reported window show
/v1/search/contentsucceeding when target processing stayed below eight seconds, then returningelb_status=502 target_status=- response_processing=-1when target processing crossed roughly 10–11 seconds. The ECS task remained healthy and the same endpoint recovered without task replacement.createSessionsServerdid not setBun.serve.idleTimeout. Bun's 10-second default applies to in-flight handlers that have not emitted response bytes, so slow or pool-contention-delayed database searches had their connection reset before the handler returned JSON.Todos:
471bef3b-7ed4-4758-b9eb-06c485dc6a03(OPE25-00018)Validation
Expected: 60,Received: undefinedbun test test/server.test.ts: 10 passed, 0 failedbun test test/server.test.ts test/serve-v1.test.ts test/mcp-http.test.ts: 23 passed, 0 failedbun run typecheck: exit 0bun run build: exit 0bun test: one unrelated watcher timeout intest/codewith-source.test.ts; exact file rerun passed 7/7, including the timed-out case in 1.13 secondsHosted path
The three originally failing commands now return
[]with exit 0 on the current production service. The candidate itself is not deployed by this PR, so a concurrency/slow-query hosted verification remains a post-deployment gate.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.