Exception "got Future <Future pending> attached to a different loop"
jcam5826 opened this issue · comments
In the celery_task.py file you have this ...
@celery.task(name="tasks.print_hero")
def print_hero(hero_id: UUID) -> None:
hero = runnify(get_hero)(hero_id=hero_id)
return hero.id
I found an issue in implementing a version of the above code in my project. After a task is run once, I was getting a cryptic exception "got Future attached to a different loop". After a lot of head scratching, the following resolved the problem.
asyncio.get_event_loop().run_until_complete(get_hero(hero_id=hero_id))
Sorry, I have not taken the time to confirm that your project has the same problem. I'm posting just in case someone else runs into the problem.
Thank you for your excellent project. It has helped a lot.
Hello @jcam5826 I am sorry for the late reply and thanks for your positive feedback. Sure I am going to check this bug you had in your custom project and replicate it.