NehanPathan commented on code in PR #1170: URL: https://github.com/apache/lucenenet/pull/1170#discussion_r2301508123
########## src/Lucene.Net.Replicator/SessionToken.cs: ########## @@ -112,6 +114,33 @@ public void Serialize(DataOutputStream writer) } } + /// <summary> + /// Asynchronously serialize the token data for communication between server and client. + /// </summary> + /// <param name="output">The <see cref="Stream"/> to write the token data to.</param> + /// <param name="cancellationToken">A cancellation token to observe while waiting for the flush to complete.</param> + /// <returns>A task representing the asynchronous operation.</returns> + public async Task SerializeAsync(Stream output, CancellationToken cancellationToken = default) + { + using var writer = new DataOutputStream(output); + writer.WriteUTF(Id); Review Comment: --- @paulirwin, @NightOwl888, Testing Completed..... Confirmed that the synchronous `WriteUTF` and related methods will fail if `AllowSynchronousIO` is disabled, since they perform blocking writes. For now, leaving them as-is with `AllowSynchronousIO = true` works reliably. Given that, would you suggest we: 1. Keep the current synchronous implementation for now to keep the PR small and stable, **or** 2. Attempt a full async rewrite of `WriteUTF` and similar methods using `SemaphoreSlim` and `WriteAsync`, even though that would be a larger change? --- -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@lucenenet.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org