fix(api): filter /v1/sessions to active only, reduce take from 150 to 50#1415
Open
buallen wants to merge 4 commits into
Open
fix(api): filter /v1/sessions to active only, reduce take from 150 to 50#1415buallen wants to merge 4 commits into
buallen wants to merge 4 commits into
Conversation
Problem: GET /v1/sessions was returning all sessions regardless of status (up to 150 records), producing a 701KB+ response body. When accessed via Cloudflare free tunnels, QUIC stalls on large response bodies, causing the mobile happy app's session list to hang indefinitely and never load. Fix: Add `active: true` filter to the Prisma query so only active sessions are returned, and reduce `take` from 150 to 50 to further cap response size. This brings the typical response down to ~152KB, well within Cloudflare's free tunnel limits. Note: A long-term solution should consider proper pagination or migrating clients to the existing /v2/sessions/active endpoint. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Problem
GET /v1/sessionsreturns all sessions regardless of status (up to 150 records), producing a 701KB+ response body. When accessed via Cloudflare free tunnels, QUIC stalls on large response bodies, causing the mobile happy app's session list to hang indefinitely and never load.Fix
active: truefilter to the Prisma query so only active sessions are returnedtakefrom150to50to further cap response sizeThis brings the typical response down to ~152KB, well within Cloudflare free tunnel limits.
Long-term Recommendation
Consider one of the following for a more robust solution:
cursor/pageparams to/v1/sessionsso clients can request sessions incrementally/v2/sessions/active: The existing v2 endpoint already filters to active sessions — consider updating mobile clients to use this endpoint directlyTesting
🤖 Generated with Claude Code