gaiacoop / django-huey

A django integration for huey task queue that supports multi queue management
MIT License
67 stars 5 forks source link

Task object is None? #18

Closed mathijsfr closed 4 months ago

mathijsfr commented 6 months ago

I am trying to retrieve a Task object from my tasks so that I can wait for multiple tasks at the same time. My current code setup is something like this:

@db_task(queue='new_queue')
def function_wrapper():
    print('task is running')
    return True  # must return something for blocking to work

@db_task(queue='new_queue')
def sync():   
    product_tasks = [
            function_wrapper(),
            function_wrapper(),
            function_wrapper(),
            function_wrapper(),
        ]
    results = [task_result.get(blocking=True) for task_result in product_tasks]

However, it seems that the function_wrapper() returns None instead of a task object. The print function is shown correctly in the outputs when running the queue.

pablop94 commented 6 months ago

Hi, I've tested this code and if check the results variable I get [True, True, True, True]. What are you expecting?