Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .changes/serial-cancellation
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
patch type="fixed" "Serial operations cancellation semantics"
4 changes: 2 additions & 2 deletions Sources/LiveKit/Support/SerialRunnerActor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ actor SerialRunnerActor<Value: Sendable> {

func run(block: @Sendable @escaping () async throws -> Value) async throws -> Value {
let task = Task { [previousTask] in
// Wait for the previous task to complete, but cancel it if needed
if let previousTask, !Task.isCancelled {
// Always wait for the previous task to maintain serial ordering
if let previousTask {
Copy link
Contributor

@pblazej pblazej Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just wondering what would happen if we move this wait before Task (essentially "blocking" run)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NVM, it just breaks the assumptions made in the 3rd test case 👍

// If previous task is still running, wait for it
_ = try? await previousTask.value
}
Expand Down
Loading