Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Your task is implicitly not function-scoped as you want it to survive exiting the function. What your doing here would be better architecturally done with threads. async is not a direct replacement for threading.

But, you could also return the task object to the caller and have them manage it. There's also nothing async about your function, so you don't need the async or to await it.



Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: