feat: timeouts on tasks

This commit is contained in:
2025-12-17 03:06:29 +03:00
parent 6955710b7e
commit 50527d2f6d

View File

@@ -12,7 +12,7 @@ from database import Marketplace, Company
from utils import chunk_list from utils import chunk_list
SMALL_TIMEOUT = 100 SMALL_TIMEOUT = 100
LARGE_TIMEOUT = 15 * 60 LARGE_TIMEOUT = 30 * 60
@taskiq_broker.task(task_name='process_update', timeout=SMALL_TIMEOUT) @taskiq_broker.task(task_name='process_update', timeout=SMALL_TIMEOUT)
@@ -62,7 +62,7 @@ async def flush_buffer():
logging.error(f'Error in flush_buffer: {e}') logging.error(f'Error in flush_buffer: {e}')
@taskiq_broker.task(schedule=[{"cron": "*/15 * * * *"}], timeout=LARGE_TIMEOUT) @taskiq_broker.task(schedule=[{"cron": "*/30 * * * *"}], timeout=LARGE_TIMEOUT)
async def reset_companies_with_zero_balance(): async def reset_companies_with_zero_balance():
logging.info(f'Flushing zero balance companies') logging.info(f'Flushing zero balance companies')
async for session in get_session(): async for session in get_session():