Huey running task multiple times

I have a Huey task on a Django app that sends emails. The task runs every morning at 9am and is meant to send an email to certain customers.

The task runs successfully, but runs again and again rather than just once, sending about 20 emails to each customer.

def email_task():
    emails_to_send = Customer.objects.filter(email_to_send=True)

    for customer in emails_to_send:
    return True

I've added a bool flag to the query and tried locking the task, but it keeps running multiple times.

How do I make it just run once?

Back to Top