-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Context
From PR #401 code review - Medium priority performance optimization.
Current Implementation
Cache keys are generated by joining sorted scopes with comma:
cache_key = f"{user_id}:background:{','.join(sorted(required_scopes))}"Problem
For requests with many scopes, this creates long cache keys. While functional, hashing would be more efficient.
Proposed Solution
Use hash of sorted scopes instead:
import hashlib
scope_hash = hashlib.sha256(','.join(sorted(required_scopes)).encode()).hexdigest()[:16]
cache_key = f"{user_id}:background:{scope_hash}"Benefits
- Shorter cache keys (fixed 16 chars vs variable length)
- Faster cache lookups with many scopes
- Reduced memory footprint in cache storage
References
- File: nextcloud_mcp_server/auth/token_broker.py:323
- Related to PR feat(astrolabe): Nextcloud app UI with PDF viewer, webhooks, and OAuth refresh #401 security fixes
Priority
Medium - Performance optimization, no correctness impact
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request