NatsObjStore.ListAsync hangs if bucket is empty
darkwatchuk opened this issue · 4 comments
darkwatchuk commented
Observed behavior
As per title, if an object store bucket has no entries, then calling ListAsync hangs and doesn't return.
Expected behavior
Enumerator should return
Server and client version
Client : .Net 2.3.3
Server : Various
Host environment
No response
Steps to reproduce
No response
darkwatchuk commented
Here's a test that fails, not quite sure the best way to solve this...
[Fact]
public async Task Enumerate_empty_object_store()
{
var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
var cancellationToken = cts.Token;
await using var server = NatsServer.StartJS();
await using var nats = server.CreateClientConnection();
var js = new NatsJSContext(nats);
var ob = new NatsObjContext(js);
var objStore = await ob.CreateObjectStoreAsync(new NatsObjConfig("emptyStore"), cancellationToken);
await foreach (var stream in objStore.ListAsync(cancellationToken: cancellationToken))
{
}
}
mtmk commented
thanks @darkwatchuk! this is a bug. we had similar issues with KV watchers and solved them using some message properties.
Ivandemidov00 commented
Hi guys. I see the OnNoData
function in the NatsKV. I think this solution can be applied to NatsObjStore. Can I fix this bug?
mtmk commented
Hi guys. I see the
OnNoData
function in the NatsKV. I think this solution can be applied to NatsObjStore. Can I fix this bug?
thanks @Ivandemidov00 absolutely please go for it 💯