-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: upgrade everything to .net 8.0 lts (#136)
* feat: upgrade everything to .net 8.0 lts * fix: upgrade to .net 8.0 causes changes to public api * chore: more logging to diagnose the flaky test * chore: removed obsolete code. added more logging to diagnose query channel test failure * chore: scan dotnet code using sonarscanner tool * fix: forgot to add the env vars to the workflow * chore: attempt at fixing the sonar host url * fix: no url when ending sonarscanner * chore: simplified the use of buffers, the flow control channel and concurrent workflow * chore: more logging, unique message names per test to minimize test collisions
- Loading branch information
Showing
34 changed files
with
445 additions
and
825 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"sdk": { | ||
"version": "6.0.417" | ||
"version": "8.0.100" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 21 additions & 14 deletions
35
src/AxonIQ.AxonServer.Connector/BufferedQueryResponseChannel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,39 @@ | ||
using System.Threading.Channels; | ||
using Io.Axoniq.Axonserver.Grpc; | ||
using Io.Axoniq.Axonserver.Grpc.Query; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace AxonIQ.AxonServer.Connector; | ||
|
||
internal class BufferedQueryResponseChannel : IQueryResponseChannel | ||
internal class BufferedQueryResponseChannel(ChannelId id, Channel<QueryReply> channel, ILogger logger) : IQueryResponseChannel | ||
{ | ||
private readonly Channel<QueryReply> _channel; | ||
private long _completed = Completed.No; | ||
|
||
public BufferedQueryResponseChannel(Channel<QueryReply> channel) | ||
{ | ||
_channel = channel; | ||
} | ||
|
||
public ValueTask SendAsync(QueryResponse response, CancellationToken cancellationToken) | ||
{ | ||
return _channel.Writer.WriteAsync(new QueryReply.Send(response), cancellationToken); | ||
logger.LogDebug("Sending query response on channel {ChannelId}: {Response}", id.ToString(), response); | ||
return channel.Writer.WriteAsync(new QueryReply.Send(id, response), cancellationToken); | ||
} | ||
|
||
public async ValueTask CompleteAsync(CancellationToken cancellationToken) | ||
public ValueTask CompleteAsync(CancellationToken cancellationToken) | ||
{ | ||
await _channel.Writer.WriteAsync(new QueryReply.Complete(), cancellationToken); | ||
_channel.Writer.Complete(); | ||
if(Interlocked.CompareExchange(ref _completed, Completed.Yes, Completed.No) == Completed.No) | ||
{ | ||
logger.LogDebug("Completing query response channel {ChannelId}", id.ToString()); | ||
return channel.Writer.WriteAsync(new QueryReply.Complete(id), cancellationToken); | ||
} | ||
logger.LogDebug("Query response channel {ChannelId} already completed", id.ToString()); | ||
return ValueTask.CompletedTask; | ||
} | ||
|
||
public async ValueTask CompleteWithErrorAsync(ErrorMessage error, CancellationToken cancellationToken) | ||
public ValueTask CompleteWithErrorAsync(ErrorMessage error, CancellationToken cancellationToken) | ||
{ | ||
await _channel.Writer.WriteAsync(new QueryReply.CompleteWithError(error), cancellationToken); | ||
_channel.Writer.Complete(); | ||
if (Interlocked.CompareExchange(ref _completed, Completed.Yes, Completed.No) == Completed.No) | ||
{ | ||
logger.LogDebug("Completing query response channel {ChannelId} with {Error}", id.ToString(), error); | ||
return channel.Writer.WriteAsync(new QueryReply.CompleteWithError(id, error), cancellationToken); | ||
} | ||
logger.LogDebug("Query response channel {ChannelId} already completed", id.ToString()); | ||
return ValueTask.CompletedTask; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
namespace AxonIQ.AxonServer.Connector; | ||
|
||
internal readonly struct ChannelId : IEquatable<ChannelId> | ||
{ | ||
public static ChannelId New() => new(Guid.NewGuid().ToString("D")); | ||
|
||
private readonly string _value; | ||
|
||
public ChannelId(string value) | ||
{ | ||
if (value == null) | ||
{ | ||
throw new ArgumentNullException(nameof(value)); | ||
} | ||
|
||
if (value == "") | ||
{ | ||
throw new ArgumentException("The channel identifier can not be empty.", nameof(value)); | ||
} | ||
|
||
_value = value; | ||
} | ||
|
||
public bool Equals(ChannelId other) => other._value.Equals(_value); | ||
public override bool Equals(object? obj) => obj is ChannelId other && other.Equals(this); | ||
public override int GetHashCode() => HashCode.Combine(_value); | ||
public override string ToString() => _value; | ||
public static bool operator ==(ChannelId left, ChannelId right) => left.Equals(right); | ||
public static bool operator !=(ChannelId left, ChannelId right) => !left.Equals(right); | ||
} |
Oops, something went wrong.