perf(npm): cache NPM JWT instead of re-authenticating on every API call
Every NPM helper (proxy host create/update/delete, streams, certs) did a fresh POST /api/tokens login before its actual request, adding an avoidable round-trip to every proxy/stream operation. - Cache the JWT per (api_url, email), sized from its 'exp' claim - Transparently re-authenticate and retry once on a 401 (e.g. after an NPM restart invalidates a cached token), so a stale cache entry can't cause a hard failure Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
+1
-1
@@ -33,7 +33,7 @@ logger = logging.getLogger(__name__)
|
||||
app = FastAPI(
|
||||
title="NetBird MSP Appliance",
|
||||
description="Multi-tenant NetBird management platform for MSPs",
|
||||
version="1.1.0",
|
||||
version="1.1.1",
|
||||
docs_url="/api/docs",
|
||||
redoc_url="/api/redoc",
|
||||
openapi_url="/api/openapi.json",
|
||||
|
||||
Reference in New Issue
Block a user