Skip to content

Commit 6c61398

Browse files
authored
stop existing go routines in ConflictResolver shutdown (#28576)
1 parent 1d1193d commit 6c61398

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

go/kbfs/libkbfs/conflict_resolver.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,11 @@ func (cr *ConflictResolver) Wait(ctx context.Context) error {
311311
// goroutines.
312312
func (cr *ConflictResolver) Shutdown() {
313313
cr.stopProcessing()
314+
cr.ForceCancel()
315+
// Wait for all resolution goroutines to finish before returning.
316+
// This prevents the DB from being closed while goroutines are still
317+
// trying to write to it (which would cause a panic).
318+
_ = cr.resolveGroup.Wait(context.Background())
314319
}
315320

316321
// Pause cancels any ongoing resolutions and prevents any new ones from

0 commit comments

Comments
 (0)