fix(config): emit background-ops advisory logs once per process
`_get_background_operations_enabled()` was emitting three advisory log lines (1 INFO + 2 deprecation WARNINGs) on every call. Because `get_settings()` is intentionally non-cached and runs on every MCP tool invocation via `get_client()`, the "Automatically enabled background operations for semantic search in multi-user mode" INFO line was firing per-request — 569 entries/hour in one production tenant. Gate the three log emissions behind a module-level `_bg_ops_advisories_logged` flag, mirroring the existing `_warn_missing_secret_once` precedent in `vector/webhook_receiver.py`. The boolean-derivation path stays unchanged, so the `Settings` value remains fresh per call. Extends the autouse `_reload_dynaconf_after_test` fixture to reset the new flag between tests, and adds two regression tests that call `get_settings()` five times and assert each advisory fires exactly once. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
b6bb3218bc
commit
79ea4e9e21
@@ -16,6 +16,7 @@ def _reload_dynaconf_after_test():
|
||||
validation should call _reload_config() explicitly.
|
||||
"""
|
||||
yield
|
||||
from nextcloud_mcp_server.config import _dynaconf
|
||||
from nextcloud_mcp_server import config as _config
|
||||
|
||||
_dynaconf.reload()
|
||||
_config._dynaconf.reload()
|
||||
_config._bg_ops_advisories_logged = False
|
||||
|
||||
Reference in New Issue
Block a user