Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/boost/boost_datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ func saveData(contractHash string) {
default:
// Queue is full, skip this one (it will be retried in the next save cycle)
log.Printf("Save queue full, skipping contract: %s", contractHash)
delete(pendingSaves, contractHash) // Remove from pending since we couldn't queue it
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete(pendingSaves, contractHash) in the default branch is currently a no-op because this branch is only reached when !pendingSaves[contractHash] and the map entry is never set to true before the select. This makes the inline comment misleading and adds confusion. Either remove the delete(...) and adjust the comment, or set pendingSaves[contractHash]=true before attempting to enqueue and only delete(...) on enqueue failure.

Suggested change
delete(pendingSaves, contractHash) // Remove from pending since we couldn't queue it

Copilot uses AI. Check for mistakes.
saveQueueMutex.Unlock()
continue
Comment on lines 115 to 120
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Queue-full handling is improved here, but saveData(contractHash != "") still does a blocking saveQueue <- contractHash while holding saveQueueMutex (see lines ~96-102). If the channel is full, that goroutine blocks holding the mutex; the worker goroutine needs the same mutex to delete(pendingSaves, ...) after processing, so it can deadlock (worker blocks on mutex and stops draining the channel, sender blocks on full channel). Consider never holding saveQueueMutex across a channel send: e.g., check/mark under the mutex, unlock, then do a non-blocking send (and on failure re-lock and unmark), or use the same select { case saveQueue <- ...: ... default: ... } pattern for the single-contract path too.

Copilot uses AI. Check for mistakes.
}
Expand Down
Loading