Make isolated execute on async testing eventloop actually run (#3116)

Motivation:

The isolated execute on async testing event loop wouldn't execute tasks
in the case of promise being nil

Modifications:

Rewrite the execute logic slightly.

Result:

Correct execution

Co-authored-by: George Barnett <gbarnett@apple.com>
This commit is contained in:
Cory BenfieldandGeorge Barnett authored and GitHub committed 2025-02-18 19:03:24 +00:00
1 parent 42bea78572
commit f46998ce2d
2 files changed
+5 -2

No files matched your search

@@ -146,7 +146,8 @@ public final class NIOAsyncTestingEventLoop: EventLoop, @unchecked Sendable {
task: {
do {
// UnsafeUnchecked is acceptable because we know we're in the loop here.
promise?.assumeIsolatedUnsafeUnchecked().succeed(try task())
let result = try task()
promise?.assumeIsolatedUnsafeUnchecked().succeed(result)
} catch let err {
promise?.fail(err)
}