jet / equinox

.NET event sourcing library with CosmosDB, DynamoDB, EventStoreDB, message-db, SqlStreamStore and integration test backends. Focused at stream level; see https://github.com/jet/propulsion for cross-stream projections/subscriptions/reactions
https://github.com/jet/dotnet-templates
Apache License 2.0
472 stars 68 forks source link

eqx stats cosmos: Handle empty container #464

Closed bartelink closed 1 month ago

bartelink commented 1 month ago

4.1.0-alpha releases fail with an exception when dotnet tool run eqx -Q stats cosmos -c <name of empty container> is run on an empty container (computation of Oldest does not cater for an empty resultset)

System.ArgumentException: The input task sequence was empty. (Parameter 'source')
   at <StartupCode$FSharp-Control-TaskSeq>.$TaskSeq.head@283.Invoke(Unit unitVar0)
   at <StartupCode$FSharp-Control-TaskSeq>.$TaskSeq.head@283-2.MoveNext()
   at Microsoft.FSharp.Control.AsyncResult`1.Commit() in D:\a\_work\1\s\src\FSharp.Core\async.fs:line 453
   at Microsoft.FSharp.Control.AsyncPrimitives.QueueAsyncAndWaitForResultSynchronously[a](CancellationToken token, FSharpAsync`1 computation, FSharpOption`1 timeout) in D:\a\_work\1\s\src\FSharp.Core\async.fs:line 1133
   at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronously[T](CancellationToken cancellationToken, FSharpAsync`1 computation, FSharpOption`1 timeout) in D:\a\_work\1\s\src\FSharp.Core\async.fs:line 1160
   at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken) in D:\a\_work\1\s\src\FSharp.Core\async.fs:line 1504
   at Equinox.Tool.Program.main(String[] argv) in /_//tools/Equinox.Tool/Program.fs:line 840
bartelink commented 1 month ago

Fixed in cosmos-linq branch via using tryHead