Skip to content

Commit

Permalink
fix: ensure that descent count decrements always happen before comple…
Browse files Browse the repository at this point in the history
…tion of another descent is sent via channel (#420)
  • Loading branch information
zinic authored Feb 15, 2024
1 parent 9817ee1 commit 2a63d3a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/go/dawgs/traversal/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ func (s IDTraversal) BreadthFirst(ctx context.Context, plan IDPlan) error {
errors.Add(fmt.Errorf("%w - Limit: %.2f MB - Memory In-Use: %.2f MB", ops.ErrTraversalMemoryLimit, tx.TraversalMemoryLimit().Mebibytes(), pathTree.SizeOf().Mebibytes()))
}

// Mark descent for this segment as complete
descentCount.Add(-1)

if !channels.Submit(traversalCtx, completionC, struct{}{}) {
return nil
}

// Mark descent for this segment as complete
descentCount.Add(-1)
}
}); err != nil && err != graph.ErrContextTimedOut {
// A worker encountered a fatal error, kill the traversal context
Expand Down

0 comments on commit 2a63d3a

Please sign in to comment.