From 7ae1fff47f0c189b06aa0a0acc55157d8fe49b15 Mon Sep 17 00:00:00 2001 From: Ruben Bartelink Date: Mon, 17 Feb 2020 14:30:46 +0000 Subject: [PATCH] Comment version inferences --- src/Equinox.EventStore.Grpc/EventStoreGrpc.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Equinox.EventStore.Grpc/EventStoreGrpc.fs b/src/Equinox.EventStore.Grpc/EventStoreGrpc.fs index 2aef77a05..045477fe7 100755 --- a/src/Equinox.EventStore.Grpc/EventStoreGrpc.fs +++ b/src/Equinox.EventStore.Grpc/EventStoreGrpc.fs @@ -186,9 +186,9 @@ module private Read = let version = match events with | [||] when direction = Direction.Backwards -> -1L // When reading backwards, the startPos is End, which is not directly convertible - | [||] -> startPos.ToInt64() - | xs when direction = Direction.Backwards -> xs.[0].Event.EventNumber.ToInt64() - | xs -> xs.[xs.Length - 1].Event.EventNumber.ToInt64() + | [||] -> startPos.ToInt64() // e.g. if reading forward from (verified existing) event 10 and there are none, the version is still 10 + | xs when direction = Direction.Backwards -> xs.[0].Event.EventNumber.ToInt64() // the events arrive backwards, so first is the 'version' + | xs -> xs.[xs.Length - 1].Event.EventNumber.ToInt64() // In normal case, the last event represents the version of the stream return version, events with :? StreamNotFoundException -> return -1L, [||] }