From b385d8470582ab39c13537f719be490dca5b5c73 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 30 Jan 2026 01:49:54 +0000 Subject: [PATCH 1/3] Initial plan From 2946caeb4c840963ba9bda5a998b438377cf1b81 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 30 Jan 2026 01:52:20 +0000 Subject: [PATCH 2/3] Fix race condition by moving pendingSaves deletion after processing Co-authored-by: mkmccarty <57630+mkmccarty@users.noreply.github.com> --- src/boost/boost_datastore.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/boost/boost_datastore.go b/src/boost/boost_datastore.go index a788fdde..b5fc84d5 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) } }() } From b209dca2b2a804fac715a63c5a758e11a56817e2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 30 Jan 2026 01:58:42 +0000 Subject: [PATCH 3/3] Add mutex protection for contract access during save Co-authored-by: mkmccarty <57630+mkmccarty@users.noreply.github.com> --- src/boost/boost_datastore.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/boost/boost_datastore.go b/src/boost/boost_datastore.go index b5fc84d5..4265d9bf 100644 --- a/src/boost/boost_datastore.go +++ b/src/boost/boost_datastore.go @@ -134,8 +134,11 @@ func processSingleContractSave(contractHash string) { return } + // Lock the contract to ensure thread-safe access during save + contract.mutex.Lock() contract.LastSaveTime = time.Now() saveSqliteData(contract) + contract.mutex.Unlock() } /*