Convert all Chinese comments, docstrings, logger/print output, HTTPException detail messages, and API response messages to English across the entire codebase. Functional zh/ja localized strings (e.g. prompt templates, timezone display names, date formats) are preserved as-is. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
31 lines
948 B
Python
31 lines
948 B
Python
#!/usr/bin/env python3
|
|
"""
|
|
Queue configuration using SqliteHuey for asynchronous file processing.
|
|
"""
|
|
|
|
import os
|
|
import logging
|
|
from huey import SqliteHuey
|
|
from datetime import timedelta
|
|
|
|
# Configure logging
|
|
logger = logging.getLogger('app')
|
|
|
|
# Ensure projects/queue_data directory exists
|
|
queue_data_dir = os.path.join(os.path.dirname(__file__), '..', 'projects', 'queue_data')
|
|
os.makedirs(queue_data_dir, exist_ok=True)
|
|
|
|
# Initialize SqliteHuey
|
|
huey = SqliteHuey(
|
|
filename=os.path.join(queue_data_dir, 'huey.db'),
|
|
name='file_processor', # Queue name
|
|
always_eager=False, # Set to False to enable async processing
|
|
utc=True, # Use UTC time
|
|
)
|
|
|
|
# Set default task configuration
|
|
huey.store_errors = True # Store error information
|
|
huey.max_retries = 3 # Maximum retry count
|
|
huey.retry_delay = timedelta(seconds=60) # Retry delay
|
|
|
|
logger.info(f"SqliteHuey queue initialized, database path: {os.path.join(queue_data_dir, 'huey.db')}") |