Race condition: Missing entries in key value store

Nothing super proprietary here. It’s a work in progress, and I had to get some things updated after changing how I wanted to store items in Badger. The example is in a repository I made public here:

This is a small part of a bigger project, and I want the project event sourced. I’m using Badger to store the events and pull them back later. Again, on my machine (Windows 10), I had to use CGO_ENABLED=0 since git bash does not include GCC–and I prefer to keep implementations pure when possible.

The committed code has the failure in place. I do have a commented out line with a //FIXME: in the Append() method. If you uncomment it, you see how the slight delay does let something happen. I just wish there was something better than time.Sleep()