NehanPathan opened a new pull request, #1170: URL: https://github.com/apache/lucenenet/pull/1170
--- * @paulirwin for review. **Linked Issue:** Fixes #1169 **Description:** This PR implements asynchronous support for the replication framework in Lucene.NET, based on suggestions from @paulirwin. The changes include: 1. **`IReplicationService` interface** * Added `Task PerformAsync(IReplicationRequest request, IReplicationResponse response, CancellationToken cancellationToken = default)` * Supports cancellation and async execution of replication tasks. 2. **`IReplicationResponse` interface** * Added `Task FlushAsync(CancellationToken cancellationToken = default)` * Provides asynchronous flush support to the underlying response stream. 3. **`ReplicationService` class** * Added `PerformAsync` method mirroring `Perform`, using `await` for I/O operations (`Stream.CopyToAsync`, `WriteAsync`, `FlushAsync`). * Accepts optional `CancellationToken` for cooperative cancellation. 4. **`SessionToken` class** * Added `Task SerializeAsync(Stream output, CancellationToken cancellationToken = default)` to allow asynchronous serialization. 5. **`AspNetCoreReplicationResponse` class** * Added `FlushAsync` method that calls `HttpResponse.Body.FlushAsync` with optional `CancellationToken`. **Motivation:** * Modern .NET applications require async I/O for scalability and responsiveness. * Existing synchronous methods require `AllowSynchronousIO=true` in Kestrel, which is not recommended for production. * This PR ensures the replication API follows .NET async best practices without breaking existing synchronous behavior. **Additional Context:** * The synchronous APIs (`Perform` and `Flush`) remain unchanged for backward compatibility. * This PR improves compatibility for ASP.NET Core hosting scenarios where synchronous I/O is restricted. --- -- 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