Skip to content

Commit f88ecba

Browse files
authored
Set high priority to the tasks for suspending unit test context (#197)
1 parent 150f350 commit f88ecba

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sources/Atoms/Context/AtomTestContext.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ public struct AtomTestContext: AtomWatchableContext {
5252
await withTaskGroup(of: Bool.self) { group in
5353
let updates = _state.makeUpdateStream()
5454

55-
group.addTask { @MainActor @Sendable in
55+
group.addTask(priority: .high) { @MainActor @Sendable in
5656
for await _ in updates {
5757
return true
5858
}
5959
return false
6060
}
6161

6262
if let duration {
63-
group.addTask {
63+
group.addTask(priority: .high) {
6464
try? await Task.sleep(seconds: duration)
6565
return false
6666
}
@@ -121,7 +121,7 @@ public struct AtomTestContext: AtomWatchableContext {
121121

122122
let updates = _state.makeUpdateStream()
123123

124-
group.addTask { @MainActor @Sendable in
124+
group.addTask(priority: .high) { @MainActor @Sendable in
125125
guard !check() else {
126126
return false
127127
}
@@ -136,7 +136,7 @@ public struct AtomTestContext: AtomWatchableContext {
136136
}
137137

138138
if let duration {
139-
group.addTask {
139+
group.addTask(priority: .high) {
140140
try? await Task.sleep(seconds: duration)
141141
return false
142142
}

0 commit comments

Comments
 (0)