Book: Hexagonal Architecture in Python
Companion code: hexagonal-python-examples — every listing from the book, free on GitHub
My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools
Me: xgabriel.com | GitHub
You write asyncio.create_task(send_webhook(order)) in a request handler, return the response, and move on. Most days the webhook goes out. Some days it doesn't, and the only trace is one log line: Task was destroyed but it is pending!
That is documented behavior. The asyncio docs for create_task carry an "Important" box: "Save a reference to the result of this function, to avoid a task disappearing mid-execution. The event loop only keeps weak references to tasks. A task that isn't referenced elsewhere may get garbage collected at any time, even before it's done."
The box came out of bpo-44665 , filed in 2021.…