Skip to content

Commit 95cc28a

Browse files
authored
Try to avoid concurrency flakiness (#1369)
1 parent 7940588 commit 95cc28a

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
@@ -573,7 +573,9 @@
573573
if "\(self.file)" == "\(file)" {
574574
self.line = line
575575
}
576-
await Task.megaYield()
576+
// NB: Give concurrency runtime more time to kick off effects so users don't need to manually
577+
// instrument their effects.
578+
await Task.megaYield(count: 20)
577579
return .init(rawValue: task, timeout: self.timeout)
578580
}
579581

@@ -1041,7 +1043,7 @@
10411043
}
10421044

10431045
extension Task where Success == Never, Failure == Never {
1044-
static func megaYield(count: Int = 6) async {
1046+
static func megaYield(count: Int = 10) async {
10451047
for _ in 1...count {
10461048
await Task<Void, Never>.detached(priority: .low) { await Task.yield() }.value
10471049
}

0 commit comments

Comments
 (0)