mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-06-24 12:21:58 +02:00
8d56a41a40
`QueuedTask.resultTask` passed `self.priority` as `initialPriority` to
`withTaskPriorityChangedHandler`. If `elevatePriority(to:)` ran before
`resultTask`'s body started (e.g. the detached task hadn't been scheduled
yet), `self.priority` was already set to the elevated value, so the
polling baseline matched `Task.currentPriority` and `taskPriorityChanged`
never fired. The callback is what calls `poke()`, so the scheduler never
re-evaluated the elevated task and it could stall until an upstream 180s
timeout cancelled the chain.
Use the captured `priority` parameter instead. It matches the priority
that `Task.detached(priority: priority)` uses to launch the resultTask
and isn't subject to mutation by `elevatePriority`.
(cherry picked from commit 6cf8500d8b)