Skip to content

Commit b9f6e38

Browse files
stephencelismluisbrown
authored andcommitted
Try to avoid concurrency flakiness (#1369)
(cherry picked from commit 95cc28a0ded8ed9b530266c080c5675f053c69bc)
1 parent 7fd7f32 commit b9f6e38

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Sources/ComposableArchitecture/TestStore.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,9 @@
576576
if "\(self.file)" == "\(file)" {
577577
self.line = line
578578
}
579-
await Task.megaYield()
579+
// NB: Give concurrency runtime more time to kick off effects so users don't need to manually
580+
// instrument their effects.
581+
await Task.megaYield(count: 20)
580582
return .init(rawValue: task, timeout: self.timeout)
581583
}
582584

@@ -1044,7 +1046,7 @@
10441046
}
10451047

10461048
extension Task where Success == Never, Failure == Never {
1047-
static func megaYield(count: Int = 6) async {
1049+
static func megaYield(count: Int = 10) async {
10481050
for _ in 1...count {
10491051
await Task<Void, Never>.detached(priority: .low) { await Task.yield() }.value
10501052
}

0 commit comments

Comments
 (0)