Skip to content

feat(api): add endpoint to refresh the redirects cache - #132

Merged
n-dusan merged 3 commits into
mainfrom
bojangalic/updateCacheRoutine
Oct 8, 2026
Merged

n-dusan merged 3 commits into
mainfrom
bojangalic/updateCacheRoutine

Conversation

@BojanG99

@BojanG99 BojanG99 commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Description (e.g. "Related to ...", etc.)

taf-server update inserts new redirects into the database, but the
running server only computes its in-memory map of repos-with-redirects
once at startup, so newly inserted redirects were invisible until a
restart.

Add POST /_internal/redirects/refresh, which re-queries the database
and replaces the cached set. The cache now lives behind an
Arc<RwLock<_>> so a refresh in one Actix worker/scope is visible to
all of them, instead of each clone of App holding its own copy.

The endpoint has no guard; external access is expected to be blocked
at the nginx layer (see openlawlibrary/publish-server).

Code review checklist (for code reviewer to complete)

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR)
  • Title summarizes what is changing
  • Commit messages are meaningful (see this for details)
  • Tests have been included and/or updated, as appropriate
  • Docstrings have been included and/or updated, as appropriate
  • Standalone docs have been updated accordingly

Automated tests, benchmarks and linters

You can run the tests, lints and benchmarks that are run on CI locally with:

just ci

@BojanG99
BojanG99 force-pushed the bojangalic/updateCacheRoutine branch from 4f943fc to 614683d Compare October 3, 2026 16:09

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: would moving code to an api/internal/redirects be more consistent?

@BojanG99
BojanG99 requested a review from n-dusan October 8, 2026 09:28
@n-dusan
n-dusan merged commit 6ae3850 into main Oct 8, 2026
9 checks 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