I think this might need _rwLock.EnterWriteLock();, as the _isDirty is only set after an item has been added. The method uses direct index access to _vectors, which means that concurrent calls that modify the database during a call to Save could cause corruption.
https://github.com/nickna/Neighborly/blob/30f68bb1d294824f031d1e89758b5026124bf21f/Neighborly/VectorDatabase.cs#L392-L418
I think this might need
_rwLock.EnterWriteLock();
, as the_isDirty
is only set after an item has been added. The method uses direct index access to_vectors
, which means that concurrent calls that modify the database during a call toSave
could cause corruption.