Skip to content

Commit

Permalink
hacked 9152.patch
Browse files Browse the repository at this point in the history
  • Loading branch information
vmogilev committed Jul 28, 2023
1 parent 5ea1fb4 commit 2b42793
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions go/vt/discovery/healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ func NewHealthCheck(ctx context.Context, retryDelay, healthCheckTimeout time.Dur
var topoWatchers []*TopologyWatcher
var filter TabletFilter
cells := strings.Split(cellsToWatch, ",")
if len(cells) == 0 {
if cellsToWatch == "" {
cells = append(cells, localCell)
}
for _, c := range cells {
Expand Down Expand Up @@ -319,7 +319,7 @@ func NewHealthCheck(ctx context.Context, retryDelay, healthCheckTimeout time.Dur

// start the topo watches here
for _, tw := range hc.topoWatchers {
go tw.Start()
tw.Start()
}

return hc
Expand Down
22 changes: 12 additions & 10 deletions go/vt/discovery/topology_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,19 @@ func NewCellTabletsWatcher(ctx context.Context, topoServer *topo.Server, tr Tabl
// Start starts the topology watcher
func (tw *TopologyWatcher) Start() {
tw.wg.Add(1)
defer tw.wg.Done()
ticker := time.NewTicker(tw.refreshInterval)
defer ticker.Stop()
for {
tw.loadTablets()
select {
case <-tw.ctx.Done():
return
case <-ticker.C:
go func() {
defer tw.wg.Done()
ticker := time.NewTicker(tw.refreshInterval)
defer ticker.Stop()
for {
tw.loadTablets()
select {
case <-tw.ctx.Done():
return
case <-ticker.C:
}
}
}
}()
}

// Stop stops the watcher. It does not clean up the tablets added to LegacyTabletRecorder.
Expand Down
3 changes: 2 additions & 1 deletion go/vt/vtgate/tabletgateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ func TestTabletGatewayBeginExecuteBatch(t *testing.T) {
}

func TestTabletGatewayShuffleTablets(t *testing.T) {
tg := NewTabletGateway(context.Background(), nil, nil, "local")
hc := discovery.NewFakeHealthCheck(nil)

Check failure on line 110 in go/vt/vtgate/tabletgateway_test.go

View workflow job for this annotation

GitHub Actions / Lint using golangci-lint

too many arguments (typecheck)

Check failure on line 110 in go/vt/vtgate/tabletgateway_test.go

View workflow job for this annotation

GitHub Actions / Lint using golangci-lint

too many arguments (typecheck)
tg := NewTabletGateway(context.Background(), hc, nil, "local")

ts1 := &discovery.TabletHealth{
Tablet: topo.NewTablet(1, "cell1", "host1"),
Expand Down

0 comments on commit 2b42793

Please sign in to comment.