mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
When starting a Task, by default it's launched with the same priority as the calling code. In the UI these are run on the `MainActor` with highest priority by default. If the worker thread running the Task closure gets blocked, it will cause the UI to hang. To fix this, we use `Task.detached` which runs the closure without a specific priority, which is lower than the UI thread. Furthermore, `weak self` is used to prevent retain cycles if the parent thread `deinit`s. This was causing an issue primarily when making IPC calls because those will sometimes hang until the XPC service is launched for the first time. --------- Signed-off-by: Jamil <jamilbk@users.noreply.github.com>