Fix caching issue in streams search endpoint by adding JSON.stringify cacheKey#929
Closed
Copilot wants to merge 2 commits into
Closed
Fix caching issue in streams search endpoint by adding JSON.stringify cacheKey#929Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
… cacheKey Co-authored-by: hawkrives <464441+hawkrives@users.noreply.github.com>
Member
|
@copilot Please practice TDD here, and add a test that fails before your change and passes after your change. |
Copilot
AI
changed the title
[WIP] Please investigate and resolve the comments on @frog-pond/ccc-server/pull/919
Fix caching issue in streams search endpoint by adding JSON.stringify cacheKey
Oct 6, 2025
Copilot stopped work on behalf of
drewvolz due to an error
October 6, 2025 20:07
Member
|
closing because copilot is confused |
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
The streams search endpoint was experiencing a caching issue where different search queries could return stale results. As reported in the review comments, subsequent searches with different query parameters were returning cached data from previous searches.
Root Cause
The
getStreamsfunction was memoized using thememoizepackage without specifying a customcacheKeyfunction:By default, the
memoizepackage usesarguments_[0](object reference) as the cache key. In JavaScript, objects are compared by reference, not by value. This means:Solution
Added a
cacheKeyfunction that serializes the parameters object usingJSON.stringify:This ensures that:
Also improved the conditional spread for better type safety:
Impact
Testing
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
carleton.cafebonappetit.comnode /home/REDACTED/work/ccc-server/ccc-server/node_modules/.bin/ava source/ccci-stolaf-college/v1/menu.test.ts(dns block)stodevx.github.ionode dist/source/ccc-server/index.js(dns block)stolaf.cafebonappetit.comnode /home/REDACTED/work/ccc-server/ccc-server/node_modules/.bin/ava source/ccci-stolaf-college/v1/menu.test.ts(dns block)www.stolaf.edunode /home/REDACTED/work/ccc-server/ccc-server/node_modules/.bin/ava source/ccci-stolaf-college/v1/streams.test.ts(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.