Skip to content

DT-166: Cache provider list() results with background refresh - #179

Open
abdotop wants to merge 2 commits into
masterfrom
166-cache-the-store-backed-provider-queries
Open

abdotop wants to merge 2 commits into
masterfrom
166-cache-the-store-backed-provider-queries

Conversation

@abdotop

@abdotop abdotop commented Nov 19, 2026

Copy link
Copy Markdown
Member

166 cache the store backed provider queries

- Resolve one ticket by key in any notation (tnt-393, TNT-393, TNT393),
  or by its exact `{source}:{externalId}` key when unkeyed
- Fetch comments() for every linked item in parallel and merge them into
  one discussion sorted by createdAt, undated comments last
- Resolve comment authors against the team directory and only expose
  them as { id, name }, never the raw email, login or Discord id
- Return 404 when the project or the ticket key is unknown
- Extract the project access check into withProjectAccess and reuse it
  for the tables, logs and tickets routes
- Add tests for the merge order, author resolution, key lookup, the
  unknown key case and the response shape
- Add withListCache, a stale-while-revalidate cache in front of each
  provider's list(), keyed on the project scope
- Serve list() from memory within the TTL (60s); past it, serve the
  stale list right away and refresh it once in the background
- On a failed refresh, keep serving the stale list, log
  provider-list-refresh-failed and wait 30s before retrying
- Share one STORE call between concurrent requests for the same scope
- Bound memory: no refresh timer, at most 50 scopes per provider (least
  recently read evicted first), and drop scopes unread for 15 min
- Leave comments() uncached, they are only fetched when a ticket opens
- Wrap the Jira, GitHub and Discord providers used by the tickets
  endpoints
- Add tests for the TTL, stale refresh, failure fallback and retry
  delay, single flight and both eviction rules
@abdotop abdotop self-assigned this Nov 19, 2026
@abdotop abdotop linked an issue Nov 19, 2026 that may be closed by this pull request
2 tasks

This branch has not been deployed

No deployments
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.

Cache the STORE-backed provider queries

1 participant