From 8cb94d06bfc720687d536d21f3e2dedf62bef357 Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 9 Nov 2024 11:09:16 +0300 Subject: [PATCH] feat: buffer --- background/tasks.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/background/tasks.py b/background/tasks.py index eb883f5..936ff07 100644 --- a/background/tasks.py +++ b/background/tasks.py @@ -37,6 +37,9 @@ async def flush_buffer(): product_ids = await buffer.get_tasks() total_products = len(product_ids) + if not product_ids: + logging.info('Buffer is empty') + return logging.info(f'Flushing buffer with {total_products} products') await process_update(product_ids) logging.info(f'Buffer flushed with {total_products} products')