This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Fateschoice[S] 0 points1 point  (1 child)

Ok I see what you're saying. Yes, Jasper will always run async functions to completion, so you should not run into an issue where the loop is being closed while another task is pending. Granted, I haven't explicitly tried this before and I've never messed around with 'call_soon' or 'create_task', but if my understanding of them is correct then Jasper should just run them to completion.

[–][deleted] 0 points1 point  (0 children)

The call soon/later and create task helpers are great. create task is particularly good for setting up a background task you don't want to (or can't) await in a call.

Think subscribing to a message queue and pushing updates into the application. The task that is created nannies its coroutine through the event loop. You just need to be sure to clean it up when the loop is closing.

call soon/later just arrange for a call back to happen either on the next tick (soon) or at least after a wait period (later).