odex30_standard/to_base/helper/multi_threading.py

28 lines
962 B
Python

"""
Multi-threading helper for Odoo 18
Provides Threading decorator for background processing
"""
import functools
import logging
_logger = logging.getLogger(__name__)
def Threading(db_connection_percentage=15, auto_commit=True, max_batch_size=1):
"""
Decorator for threaded execution of methods
This is a simplified version for Odoo 18 migration
Args:
db_connection_percentage: Percentage of DB connections to use
auto_commit: Whether to auto-commit transactions
max_batch_size: Maximum batch size for processing
"""
def decorator(func):
@functools.wraps(func)
def wrapper(self, *args, **kwargs):
# For now, just execute the function normally
# In production, this should implement actual threading
_logger.debug(f"Executing {func.__name__} with Threading decorator")
return func(self, *args, **kwargs)
return wrapper
return decorator