diff --git a/src/boost/boost_datastore.go b/src/boost/boost_datastore.go index e03640e2..1a0f369b 100644 --- a/src/boost/boost_datastore.go +++ b/src/boost/boost_datastore.go @@ -41,13 +41,15 @@ func sqliteInit() { func startSaveQueueWorker() { go func() { for contractHash := range saveQueue { - // Mark as no longer pending + // Process the actual save + processSingleContractSave(contractHash) + + // Mark as no longer pending after processing completes + // This ensures that if the contract is modified during processing, + // a new save request will be queued rather than being skipped saveQueueMutex.Lock() delete(pendingSaves, contractHash) saveQueueMutex.Unlock() - - // Process the actual save - processSingleContractSave(contractHash) } }() } @@ -136,6 +138,7 @@ func processSingleContractSave(contractHash string) { contract.LastSaveTime = time.Now() contract.mutex.Unlock() saveSqliteData(contract) + contract.mutex.Unlock() } /*