Skip to content

chore: guard against celery disabled - #3699

Open
stevekaplan123 wants to merge 1 commit into
masterfrom
feature/sc-46898/fix-3-failing-pytests
Open

chore: guard against celery disabled#3699
stevekaplan123 wants to merge 1 commit into
masterfrom
feature/sc-46898/fix-3-failing-pytests

Conversation

@stevekaplan123

@stevekaplan123 stevekaplan123 commented Sep 6, 2026

Copy link
Copy Markdown
Member

BLOCKED ON https://app.shortcut.com/sefaria/story/46898/fix-3-failing-pytests#activity-47021

Description

A brief description of the PR

Code Changes

The following changes were made to the files below

Notes

Any additional notes go here

@stevekaplan123
stevekaplan123 marked this pull request as ready for review September 6, 2026 09:09
@gitvelocity-reviewer

Copy link
Copy Markdown

📊 Code Quality Score: 1/100

Base 10 × ESF 0.1 (Nano: 3 effective lines, 1 file) = 1

Category Score Factors
🔭 Scope 2/20 _ensure_warm() in nonuniqueterm_index.py is the only site touched. No new public API, no new file, no cross-subsystem change.
🏗️ Architecture 1/20 No module boundary changed. A deferred import of CELERY_ENABLED is added inside the function rather than at module level; no new dependency introduced beyond what sefaria.settings already provides.
⚙️ Implementation 2/20 _ensure_warm() gains a single if not CELERY_ENABLED: return branch placed before the existing _get_registry() check, so the function exits without touching _last_rebuild_attempt when Celery is disabled.
⚠️ Risk 3/20 _ensure_warm() is on the cache-read path; returning early when the cache is cold means no rebuild is ever enqueued in non-Celery environments. A misconfigured CELERY_ENABLED=False in production would silently leave the registry cold for all callers.
✅ Quality 1/15 No test accompanies the change. No docstring update reflects the new early-exit condition.
🔒 Perf / Security 1/5 The guard avoids a Celery queue call on every cache-miss in CI and DummyCache environments, eliminating the per-read enqueue described in the existing docstring.

Was this score accurate? 👍 Yes · 👎 No

How this was scored →

Scored by GitVelocity · How are scores calculated?

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.

1 participant