From a1276e3de874ac86a6a5493305cbf410dde9d5ce Mon Sep 17 00:00:00 2001 From: alpha-nerd-nomyo Date: Thu, 29 Jan 2026 10:32:59 +0100 Subject: [PATCH] fix: correct indentation for publish_snapshot calls in usage functions This fix ensures that the snapshot publishing happens within the usage lock context, maintaining proper synchronization of usage counts. --- router.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/router.py b/router.py index 6250d11..a990cb7 100644 --- a/router.py +++ b/router.py @@ -532,7 +532,7 @@ def dedupe_on_keys(dicts, key_fields): async def increment_usage(endpoint: str, model: str) -> None: async with usage_lock: usage_counts[endpoint][model] += 1 - await publish_snapshot() + await publish_snapshot() async def decrement_usage(endpoint: str, model: str) -> None: async with usage_lock: @@ -545,7 +545,7 @@ async def decrement_usage(endpoint: str, model: str) -> None: usage_counts[endpoint].pop(model, None) #if not usage_counts[endpoint]: # usage_counts.pop(endpoint, None) - await publish_snapshot() + await publish_snapshot() async def _make_chat_request(endpoint: str, model: str, messages: list, tools=None, stream: bool = False, think: bool = False, format=None, options=None, keep_alive: str = None) -> ollama.ChatResponse: """