Skip to content

ai: cache: index the response cache by creation time - #934

Merged
rgushchin merged 1 commit into
sashiko-dev:mainfrom
ftabba:pr/cache-created-at-index
Nov 20, 2026
Merged

rgushchin merged 1 commit into
sashiko-dev:mainfrom
ftabba:pr/cache-created-at-index

Conversation

@ftabba

@ftabba ftabba commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Opening the response cache reaps expired entries with a DELETE on created_at, which isn't indexed, so every open reads the whole table. A local review opens the cache once per patch. On a 7 GB cache (a week of local reviews), a review of 23 patches hadn't started any of them after seven minutes.

An existing cache gets the index on its next open, in one pass over the table. Once it was built, the same review finished 10 patches within two minutes, from responses already in the cache.

@sashiko-bot

sashiko-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown

Sashiko review

Commit 1/1 — c2002ed8 ai: cache: index the response cache by creation time

  • [LOW] src/ai/cache.rs: CachingAiProvider::new() adds the missing index for
    the startup created_at reaper query introduced in commit 7ff827d ("ai:
    add local response cache provider"), but the commit message lacks a Fixes
    trailer. Add Fixes: 7ff827d ("ai: add local response cache provider")
    before Signed-off-by.

Full review and stage logs on sashiko.sashiko.dev

Opening the response cache reaps expired entries with a DELETE on
created_at, which isn't indexed, so every open reads the whole table.
A local review opens the cache once per patch, so on a 7 GB cache
each patch waits minutes before its first model call.

Index created_at.

Fixes: 7ff827d ("ai: add local response cache provider")
Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
@ftabba
ftabba force-pushed the pr/cache-created-at-index branch from c2002ed to e4c6609 Compare November 20, 2026 14:10
@sashiko-bot

sashiko-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown

Sashiko review — v2

✓ No issues found across 1 commit.

Full review log on sashiko.sashiko.dev

@rgushchin
rgushchin merged commit ba80c87 into sashiko-dev:main Nov 20, 2026
1 check passed
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.

2 participants