Failed searches are cached: identical searches keep failing until `cacheSearchResultsForSeconds` expires
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
- Domain
- search
Research direction
Start by locating responsePromiseCache and the client-side search request path, then reproduce the failure using the listed DevTools throttling steps. Done means a rejected search is removed from the cache so the next identical search sends a request, while successful responses and concurrent in-flight sharing remain unchanged.
Written by the indexing model from the issue text.
Description
When the client-side caching is enabled, a search request that fails , stays in the in-flight promise cache. Every identical search after that returns the same error "without sending a request to the server" until the cache TTL expires (2 minutes by default).
Trigger:
- A temporary network failure. - The user briefly loses their connectivity, their search fails, connectivity returns, and the same search keeps failing.
Steps to reproduce (tried on a live site)
On a live site (songs-search.typesense.org):
- Open DevTools -> Network, filter by
multi_search. - Set throttling to Offline and search for a new term, e.g.
bad lier. The request fails. - Set throttling back to No throttling, clear the box, and type
bad lieragain. - No
multi_searchrequest is sent and the search fails again. A different term works.bad lierworks again after 2 minutes.
after cache expires :
Expected behavior
A failed request isn't cached. The next identical search is sent to the server.
Actual behavior
The rejected promise is served from the cache until cacheSearchResultsForSeconds expires.
Proposed fix
Remove the entry from responsePromiseCache when the promise rejects, and re-throw. Successful responses and sharing of concurrent in-flight requests are unchanged.
I'm happy to send a PR for this.
- Dominant language
- TypeScript
- Stars
- 572
- Forks
- 101
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 4
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from typesense/typesense-js
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
typesense/typesense-js#374 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
typesense/typesense-js#372 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
typesense/typesense-js#369 ·
-
Typing for geo_distance_meters is too strictMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
typesense/typesense-js#348 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
typesense/typesense-js#324 · 1 comment ·
All issues in typesense/typesense-js
Similar issues
-
bug priority: P2
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
mattermost/compass-design#106 ·
Maintainers usually reply within 1 day
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:other issue-rating: 🦞 diamond lobster P2
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
openclaw/openclaw#176671 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
nordcraftengine/nordcraft#1400 ·
Maintainers usually reply within 1 day