Skip to content

Commit 2aecfff

Browse files
committed
Expose Solr cache enabled/disabled state via /status
1 parent 2da8005 commit 2aecfff

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/vfbquery/ha_api.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,21 @@ async def handle_status(request):
532532
snap = tracker.snapshot
533533
rcache = request.app["result_cache"]
534534
coalescer = request.app["coalescer"]
535+
# Solr cache status (best-effort): this may hit Solr briefly in order to
536+
# determine whether the cache is currently enabled.
537+
solr_cache_status = {
538+
"enabled": False,
539+
"disabled_until": None,
540+
}
541+
try:
542+
from vfbquery.solr_result_cache import get_solr_cache
543+
544+
solr_cache = get_solr_cache()
545+
solr_cache_status["enabled"] = solr_cache.solr_cache_enabled
546+
solr_cache_status["disabled_until"] = solr_cache.solr_cache_disabled_until
547+
except Exception:
548+
pass
549+
535550
return web.json_response({
536551
"status": "ok",
537552
"workers": request.app["max_workers"],
@@ -545,6 +560,7 @@ async def handle_status(request):
545560
"coalesced_total": coalescer.coalesced_total,
546561
"coalesced_in_flight": coalescer.in_flight_count,
547562
"scanner_probes_blocked": request.app.get("_scanner_probes", {}).get("count", 0),
563+
"solr_cache": solr_cache_status,
548564
})
549565

550566

0 commit comments

Comments
 (0)