make it great agin

This commit is contained in:
Yansong Zhang
2026-02-04 11:17:37 +08:00
parent 240684e723
commit 60e3a7b419
2 changed files with 4 additions and 6 deletions

View File

@ -1,7 +1,6 @@
import logging
import time
from collections.abc import Callable
from datetime import timedelta
from enum import StrEnum, auto
from functools import wraps
from typing import Concatenate, ParamSpec, TypeVar
@ -10,7 +9,7 @@ from flask import current_app, request
from flask_login import user_logged_in
from flask_restx import Resource
from pydantic import BaseModel
from sqlalchemy import select, update
from sqlalchemy import select
from sqlalchemy.orm import Session
from werkzeug.exceptions import Forbidden, NotFound, Unauthorized

View File

@ -206,8 +206,8 @@ class TestApiTokenCacheRedisIntegration:
def test_concurrent_cache_access(self):
"""Test concurrent cache access doesn't cause issues."""
from unittest.mock import MagicMock
import concurrent.futures
from unittest.mock import MagicMock
mock_token = MagicMock()
mock_token.id = "test-id"
@ -389,7 +389,6 @@ class TestEndToEndCacheFlow:
2. Second request (cache hit) -> return from cache
3. Verify Redis state
"""
from unittest.mock import MagicMock
test_token_value = "test-e2e-token"
test_scope = "app"
@ -441,8 +440,8 @@ class TestEndToEndCacheFlow:
def test_high_concurrency_simulation(self):
"""Simulate high concurrency access to cache."""
from unittest.mock import MagicMock
import concurrent.futures
from unittest.mock import MagicMock
test_token_value = "test-concurrent-token"
test_scope = "app"
@ -478,7 +477,7 @@ class TestEndToEndCacheFlow:
assert elapsed < 1.0, f"Too slow: {elapsed}s for 100 cache reads"
print(f"\n✓ 100 concurrent cache reads in {elapsed:.3f}s")
print(f"✓ Average: {(elapsed/100)*1000:.2f}ms per read")
print(f"✓ Average: {(elapsed / 100) * 1000:.2f}ms per read")
finally:
# Cleanup