Messages are processed almost simultaneously. When repository.collections.poiListSnapshots.findOne is called, the latest changes are not reflected, leading to inconsistencies when calculating isCompleted and poiList.
To solve the race conditions problems, interactions with the database are done through transactions. Mongo requires a replica set since version 4 to enable this feature.
Summary
docker-compose update with mongo cluster configuration
new setup.sh script added to initialize cluster + local configuration
transactions to openChargeMapConsumer + repository method startDBSession added
e2e + updated unit tests accordingly
e2e mock env variables setup
Future work
mongo-init.sh partially holds the same configuration as setup.sh, ideally this could run on init /mongo-init.sh:/docker-entrypoint-initdb.d/mongo-init.sh, but rs.initiate (replica initialization) has conflicts with it.
Messages are processed almost simultaneously. When
repository.collections.poiListSnapshots.findOne
is called, the latest changes are not reflected, leading to inconsistencies when calculatingisCompleted
andpoiList
.To solve the race conditions problems, interactions with the database are done through transactions. Mongo requires a replica set since version 4 to enable this feature.
Summary
setup.sh
script added to initialize cluster + local configurationFuture work
mongo-init.sh
partially holds the same configuration assetup.sh
, ideally this could run on init/mongo-init.sh:/docker-entrypoint-initdb.d/mongo-init.sh
, butrs.initiate
(replica initialization) has conflicts with it.