Skip to content

Add standalone cache pre-warming for selected orgs - #1251

Draft
EngCaioFonseca wants to merge 1 commit into
search_ftsfrom
cache_prewarm
Draft

EngCaioFonseca wants to merge 1 commit into
search_ftsfrom
cache_prewarm

Conversation

@EngCaioFonseca

@EngCaioFonseca EngCaioFonseca commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request Change Description

This adds 8Knot/cache_manager/prewarm.py, a command-line warmer that fills the cache for a list of orgs ahead of time, so a user's first visit to a large org doesn't trigger a cold collection.

  • Orgs are resolved with search_fts's resolve_org_repos. The warmer sends only the query/repo pairs that are still missing and checks coverage afterwards. A repeat run sends nothing.
  • No more than 4 warm tasks run at once across the whole run (--max-in-flight), leaving most of the 16 query slots for users. A task that is timed out or retrying keeps its slot until it finishes.
  • A failed org is logged and the warm carries on to the next one. The command exits nonzero if any org failed.
  • The query list moves to a new 8Knot/queries/registry.py, shared by the browser path in index_callbacks.py and the warmer.
  • The 17 query modules now import celery_app from _celery instead of app, so the warmer can load them without starting Dash. Task names are unchanged.
  • Warming is off by default: PREWARM_ORGS= is empty in .env.sample.
  • The runbook is docs/operations/cache-prewarm/README.md.
  • This is stacked on Use PostgreSQL full-text search for the Search engine  #1231 (search_fts). Retarget it to dev once that merges. It doesn't depend on Lock cache collection per query and repo #1250.

Generative AI disclosure

Please select one option:

  • This contribution was NOT assisted or created by Generative AI tools.
  • This contribution was assisted or created by Generative AI tools.

If AI tools were used, please provide details below:
- What tools were used? Claude Opus 5.5, Sonnet 5.5; GPT 5.3 codex, GPT-6-Astra
- How were these tools used? Orchestration: spec design, drafting, coding, review
- Did you review these outputs before submitting this PR? Yes.

Signed-off-by: Caio Fonseca <engcaiofonseca@protonmail.com>
@EngCaioFonseca
EngCaioFonseca marked this pull request as draft November 22, 2026 22:21
@EngCaioFonseca EngCaioFonseca self-assigned this Nov 22, 2026
@EngCaioFonseca EngCaioFonseca added the infrastructure issues pertaining to production operations or running 8Knot in prod (configuration, architecture) label Nov 22, 2026
@EngCaioFonseca

Copy link
Copy Markdown
Contributor Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Nov 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 51 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between f498c78 and 18122d2.

Files selected for processing: 22

  • .env.sample
  • 8Knot/cache_manager/prewarm.py
  • 8Knot/pages/index/index_callbacks.py
  • 8Knot/queries/affiliation_query.py
  • 8Knot/queries/cntrb_per_file_query.py
  • 8Knot/queries/commits_query.py
  • 8Knot/queries/contributors_query.py
  • 8Knot/queries/issue_assignee_query.py
  • 8Knot/queries/issues_query.py
  • 8Knot/queries/ossf_score_query.py
  • 8Knot/queries/package_version_query.py
  • 8Knot/queries/pr_assignee_query.py
  • 8Knot/queries/pr_files_query.py
  • 8Knot/queries/pr_response_query.py
  • 8Knot/queries/prs_query.py
  • 8Knot/queries/query_template.py
  • 8Knot/queries/registry.py
  • 8Knot/queries/repo_files_query.py
  • 8Knot/queries/repo_info_query.py
  • 8Knot/queries/repo_languages_query.py
  • 8Knot/queries/repo_releases_query.py
  • docs/operations/cache-prewarm/README.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure issues pertaining to production operations or running 8Knot in prod (configuration, architecture)

Projects

Development

Successfully merging this pull request may close these issues.

1 participant