Files
firezone/swift
Jamil 10847fd549 fix(apple): Use Task.detached when starting from MainActor (#7766)
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>
2025-01-16 15:26:03 +00:00
..