Refactor logging, clean dead code, fix temp files and async tasks
- Replace f-string logging with % formatting throughout - Fix create_temp_file: use mkstemp() instead of mkdtemp() (no leaked dirs) - Add cleanup background thread and copy.deepcopy to AsyncTaskManager - Fix transcribe_audio_async signature to accept transcription_service + params - Use resample_poly instead of scipy_resample for better audio quality - Remove unused validate_file/BinaryIO methods from FileValidator - Add requests to requirements.txt - Add error handling for pip install in server.sh - Add __all__ and module docstrings to __init__.py files Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
1e778cae86
commit
ca2e41e0f5
@@ -91,7 +91,8 @@ class RequestLogger:
|
||||
return
|
||||
g.start_time = time.time()
|
||||
self.logger.info(
|
||||
f"{request.method} {request.path} от {self._get_client_ip()}",
|
||||
"%s %s от %s",
|
||||
request.method, request.path, self._get_client_ip(),
|
||||
extra={"type": "request"}
|
||||
)
|
||||
|
||||
@@ -100,7 +101,8 @@ class RequestLogger:
|
||||
return response
|
||||
processing_time = time.time() - getattr(g, 'start_time', time.time())
|
||||
self.logger.info(
|
||||
f"{response.status_code} за {processing_time:.3f} сек",
|
||||
"%s за %.3f сек",
|
||||
response.status_code, processing_time,
|
||||
extra={"type": "response"}
|
||||
)
|
||||
return response
|
||||
|
||||
Reference in New Issue
Block a user