Skip to content

Commit

Permalink
feat: fix wait function to copy the array before changing it
Browse files Browse the repository at this point in the history
Signed-off-by: Manan Gupta <[email protected]>
  • Loading branch information
GuptaManan100 committed Aug 27, 2024
1 parent fc2f4ac commit 9e04eda
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion go/vt/discovery/keyspace_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package discovery
import (
"context"
"fmt"
"slices"
"sync"
"time"

Expand Down Expand Up @@ -715,7 +716,10 @@ func (kew *KeyspaceEventWatcher) GetServingKeyspaces() []string {
}

// WaitForConsistentKeyspaces waits for the given set of keyspaces to be marked consistent.
func (kew *KeyspaceEventWatcher) WaitForConsistentKeyspaces(ctx context.Context, keyspaces []string) error {
func (kew *KeyspaceEventWatcher) WaitForConsistentKeyspaces(ctx context.Context, ksList []string) error {
// We don't want to change the original keyspace list that we receive so we clone it
// before we empty it elements down below.
keyspaces := slices.Clone(ksList)
for {
// We empty keyspaces as we find them to be consistent.
allConsistent := true
Expand Down

0 comments on commit 9e04eda

Please sign in to comment.