Add retry-safe scan completion notifications

This commit is contained in:
Joren de Graaf
2026-10-26 01:57:24 +01:00
parent 0e4077d8e3
commit 31266b1533
5 changed files with 68 additions and 11 deletions
@@ -2,7 +2,8 @@ import time
from django.core.management.base import BaseCommand
from food.services.inventory_scanner import process_next_scan_item
from food.services.inventory_scanner import (dispatch_pending_scan_notifications,
process_next_scan_item)
class Command(BaseCommand):
@@ -16,6 +17,7 @@ class Command(BaseCommand):
def handle(self, *args, **options):
processed = 0
while True:
dispatch_pending_scan_notifications()
did_work = process_next_scan_item()
if did_work:
processed += 1