Skip to content

Commit ad10e79

Browse files
committed
Fix false positive stream ready timeout warning (#515)
The timeout task was logging a warning even when cancelled (streams signaled ready in time). The `try?` swallowed the `CancellationError` but then continued to log the warning. Now uses `do/catch` to only log when the sleep actually completes (true timeout), not when cancelled. **Before:** Every app launch logged 5+ "Stream ready timeout - proceeding anyway" warnings even though streams were working fine. **After:** Warning only appears if streams genuinely fail to signal ready within 10 seconds. <!-- Macroscope's pull request summary starts here --> <!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. --> <!-- If you delete either of the start / end markers from your PR's description, Macroscope will append its summary at the bottom of the description. --> > [!NOTE] > ### Suppress false stream-ready warnings by gating the 10‑second timeout task in `ConvosCore.Syncing.SyncingManager` > Wrap the stream readiness timeout task in `do/try/catch` so `Task.sleep(10s)` cancellation is swallowed and `Log.warning` plus finishing of `messageStreamReadyContinuation` and `conversationStreamReadyContinuation` only occur after an actual timeout in [SyncingManager.swift](https://github.com/xmtplabs/convos-ios/pull/515/files#diff-ba2362cf646b78283a1af17654ea8d2c18f6b1cb686a78e7761e10f1b0328101). > > #### 📍Where to Start > Start at the timeout task closure inside `SyncingManager`’s stream readiness logic in [SyncingManager.swift](https://github.com/xmtplabs/convos-ios/pull/515/files#diff-ba2362cf646b78283a1af17654ea8d2c18f6b1cb686a78e7761e10f1b0328101). > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized 0fdcf2e.</sup> > <!-- Macroscope's review summary ends here --> > <!-- macroscope-ui-refresh --> <!-- Macroscope's pull request summary ends here -->
1 parent 9b7e54c commit ad10e79

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

ConvosCore/Sources/ConvosCore/Syncing/SyncingManager.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,11 +443,15 @@ actor SyncingManager: SyncingManagerProtocol {
443443
// AsyncStream doesn't respond to task cancellation, so we must finish the
444444
// continuations to unblock the waiting tasks when timeout fires.
445445
group.addTask {
446-
try? await Task.sleep(for: .seconds(10))
447-
Log.warning("Stream ready timeout - proceeding anyway")
448-
// Finish continuations so waiting tasks complete (AsyncStream ignores cancelAll)
449-
messageStreamReadyContinuation?.finish()
450-
conversationStreamReadyContinuation?.finish()
446+
do {
447+
try await Task.sleep(for: .seconds(10))
448+
Log.warning("Stream ready timeout - proceeding anyway")
449+
// Finish continuations so waiting tasks complete (AsyncStream ignores cancelAll)
450+
messageStreamReadyContinuation?.finish()
451+
conversationStreamReadyContinuation?.finish()
452+
} catch {
453+
// Task was cancelled because streams signaled ready in time - no warning needed
454+
}
451455
}
452456

453457
// Wait for both streams to be ready OR timeout

0 commit comments

Comments
 (0)