-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
In the following code snippet:
private TaskCompletionSource _refreshTCS = null!;
public Task RefreshAsync() {
if (_refreshTCS != null)
return _refreshTCS.Task;
_refreshTCS = new();
Task.Run(() => {
using (var reader = _connection.GetReader($"{nameof(CartDetailsRm)}-ctor", Handle)) {
reader.Read<Cart>(_cartId, () => Idle, checkpoint: _cartCheckpoint);
// this seems like bad juju. is this a bug?
_cartCheckpoint = reader.Position is null
? _cartCheckpoint
: reader.Position;
_refreshTCS.SetResult();
_refreshTCS = null!;
}
});
return _refreshTCS?.Task ?? Task.CompletedTask;
}
In the event that the read from reader.Read<TAggregate>([id], () => Idle, checkpoint: ...)
does not read anything new from the provided checkpoint, reader.Position
reports null, when it should report the current position (in my opinion)