Closed SebastianMax closed 7 years ago
Hi, could you please test 2.4.18.2-SNAPSHOT (the master branch) and check if you still have the issue. I've made some small changes.
Hi, sorry for the late reply, I did not see your improvements until now. Looks very good and works for me, thank you!
Can the same bug also be fixed for the 2.5 version of akka?
Hi,
I am using akka-persistence-inmemory not only for unit-testing, but also for a proof-of-concept application that runs longer than some seconds. The application "writes" events to the
inmemory-journal
and synchronizes them viaPersistenceQuery
usingreadJournal.eventsByTag
. Theoffset-mode
is set touuid
.During testing I stumbled over the problem that after a (random) amount of time the
eventsByTag
source stops emitting events that are persisted. I currently assume this is because theInMemoryJournalStorage.eventsByTag
uses>
to compare twoTimeBasedUUIDs
, which uses thejava.util.UUID.compareTo
(InMemoryJournalStorage)However, this
compareTo
function does not use the same ordering as the TimeBasedUUIDs which are generated inUUIDS.timeBased()
.Therefore, it may happen that a current
timeBasedUUID
is less than an oldertimeBasedUUID
, and thus theeventsByTag
does not return the old (but not yet delivered) event.A small failing test confirms this behaviour:
A possible fix could be to use a different compare function, like it is done here.