Closed bminevsb closed 2 years ago
Thanks for the great write-up!
I agree - this should return []
. The change you suggest looks good but out of paranoia of what might match _
, I would prefer to add a new clause similar to the top one:
{Streams.read_resp(content: {:last_stream_position, _}), _rest} ->
[]
What do you think, would you like to submit a PR?
Sure!
From what I understand on success it can return, an event, :last_stream_position
, or :first_stream_position
:
https://github.com/EventStore/EventStore/blob/master/src/EventStore.Core/Services/Transport/Grpc/Enumerators.ReadStreamForwards.cs#L126
:first_stream_position
is returned if you call MySpearClient.stream!(stream_id, from: 31)
in the example above.
So I'll cover both cases.
That was fast! ⚡ Thanks for the quick response @the-mikedavis 🙇
I found this problem while experimenting with Spear.
Let say we have 30 events in stream with uuid
stream_id
(with numbers 0,...,29). This returns an error instead of[]
After some debugging, I found that this is caused by
Spear.Reading.Stream.wrap_buffer_in_decode_stream/3
not handling this case. Thecase
statement receives this:which produces a
FunctionClauseError
once it propagates down tounfold_continuous
.To handle this I think it should do something like: