Skip to content

Conversation

@patrick-ogrady
Copy link
Contributor

@patrick-ogrady patrick-ogrady commented Jul 25, 2023

Why this should be merged

Might resolve: #1760

How this works

We ensure that the sync target cannot be updated while we are determining whether to re-add completed workItems to the queue or mark as processed.

How this was tested

HyperSDK: ava-labs/hypersdk#278

@patrick-ogrady patrick-ogrady marked this pull request as draft July 25, 2023 22:06
@patrick-ogrady
Copy link
Contributor Author

May be a simpler fix to just reverse order of lock acquisition here:

func (m *Manager) UpdateSyncTarget(syncTargetRoot ids.ID) error {
m.workLock.Lock()
defer m.workLock.Unlock()
select {
case <-m.doneChan:
return ErrAlreadyClosed
default:
}
m.syncTargetLock.Lock()
defer m.syncTargetLock.Unlock()

Then just hold onto the updateSyncTarget lock (continue assuming workLock is managed by enqueueLock).

@StephenButtolph StephenButtolph deleted the update-sync-locking branch July 24, 2024 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant