[release] v0.12.0-unstable44

This commit is contained in:
Yann Stepienik 2023-11-06 20:10:59 +00:00
parent 050fe7484b
commit 73196dadf6
2 changed files with 3 additions and 2 deletions

View file

@ -1,6 +1,6 @@
{
"name": "cosmos-server",
"version": "0.12.0-unstable43",
"version": "0.12.0-unstable44",
"description": "",
"main": "test-server.js",
"bugs": {

View file

@ -143,10 +143,11 @@ func flushAllBuffers() {
func BufferedDBWrite(collectionName string, object map[string]interface{}) {
bufferLock.Lock()
writeBuffer[collectionName] = append(writeBuffer[collectionName], object)
bufferLock.Unlock()
if len(writeBuffer[collectionName]) >= bufferCapacity {
flushBuffer(collectionName)
}
bufferLock.Unlock()
}
func WriteToDatabase(collection *mongo.Collection, objects []map[string]interface{}) error {