Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions go/cmd/vtclient/vtclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ func execMulti(ctx context.Context, db *sql.DB, sql string) (*results, error) {
if isThrottled {
tickDuration := time.Second / time.Duration(*qps)
ticker = time.NewTicker(tickDuration)
defer ticker.Stop()
}

for j := 0; j < *count; j++ {
Expand Down
1 change: 1 addition & 0 deletions go/test/endtoend/cluster/vttablet_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ func (vttablet *VttabletProcess) GetStatusDetails() string {
// WaitForStatus waits till desired status of tablet is reached
func (vttablet *VttabletProcess) WaitForStatus(status string, howLong time.Duration) bool {
ticker := time.NewTicker(howLong)
defer ticker.Stop()
for range ticker.C {
if vttablet.GetTabletStatus() == status {
return true
Expand Down
1 change: 1 addition & 0 deletions go/test/endtoend/reparent/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ func GetShardReplicationPositions(t *testing.T, clusterInstance *cluster.LocalPr

func WaitForReplicationToStart(t *testing.T, clusterInstance *cluster.LocalProcessCluster, keyspaceName, shardName string, tabletCnt int, doPrint bool) {
tck := time.NewTicker(500 * time.Millisecond)
defer tck.Stop()
for {
select {
case <-tck.C:
Expand Down
2 changes: 2 additions & 0 deletions go/test/endtoend/tabletmanager/tablegc/tablegc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ func validateTableDoesNotExist(t *testing.T, tableExpr string) {
defer cancel()

ticker := time.NewTicker(time.Second)
defer ticker.Stop()
var foundTableName string
var exists bool
var err error
Expand All @@ -202,6 +203,7 @@ func validateTableExists(t *testing.T, tableExpr string) {
defer cancel()

ticker := time.NewTicker(time.Second)
defer ticker.Stop()
var exists bool
var err error
for {
Expand Down
1 change: 1 addition & 0 deletions go/test/endtoend/vreplication/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ func checkHealth(t *testing.T, url string) bool {
func waitForQueryToExecute(t *testing.T, conn *mysql.Conn, database string, query string, want string) {
done := false
ticker := time.NewTicker(10 * time.Millisecond)
defer ticker.Stop()
for {
select {
case <-ticker.C:
Expand Down
2 changes: 2 additions & 0 deletions go/test/endtoend/vreplication/resharding_workflows_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ const workflowStartTimeout = 5 * time.Second
func waitForWorkflowToStart(t *testing.T, ksWorkflow string) {
done := false
ticker := time.NewTicker(100 * time.Millisecond)
defer ticker.Stop()
timer := time.NewTimer(workflowStartTimeout)
defer timer.Stop()
log.Infof("Waiting for workflow %s to start", ksWorkflow)
for {
select {
Expand Down
2 changes: 2 additions & 0 deletions go/test/endtoend/vreplication/vstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func testVStreamWithFailover(t *testing.T, failover bool) {

// run two PRS after one second each, wait for events to be received and exit test
ticker := time.NewTicker(1 * time.Second)
defer ticker.Stop()
tickCount := 0
// this for loop implements a mini state machine that does the two PRSs, waits a bit after the second PRS,
// stops the insertions, waits for a bit again for the vstream to catchup and signals the test to stop
Expand Down Expand Up @@ -358,6 +359,7 @@ func testVStreamStopOnReshardFlag(t *testing.T, stopOnReshard bool, baseTabletID
}()

ticker := time.NewTicker(1 * time.Second)
defer ticker.Stop()
tickCount := 0
for {
<-ticker.C
Expand Down
1 change: 1 addition & 0 deletions go/vt/discovery/healthcheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ func TestHealthCheckVerifiesTabletAlias(t *testing.T) {
}

ticker := time.NewTicker(1 * time.Second)
defer ticker.Stop()
select {
case err := <-fc.cbErrCh:
assert.Contains(t, err.Error(), "health stats mismatch", "wrong error")
Expand Down
1 change: 1 addition & 0 deletions go/vt/logutil/purge.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ func PurgeLogs() {
logDir := f.Value.String()
program := filepath.Base(os.Args[0])
ticker := time.NewTicker(*purgeLogsInterval)
defer ticker.Stop()
for range ticker.C {
purgeLogsOnce(time.Now(), logDir, program, *keepLogsByCtime, *keepLogsByMtime)
}
Expand Down
1 change: 1 addition & 0 deletions go/vt/vtgate/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ func registerAggregator(a *TabletStatusAggregator) {
// resetAggregators resets the next stats slot for all aggregators every second.
func resetAggregators() {
ticker := time.NewTicker(time.Second)
defer ticker.Stop()
for range ticker.C {
muAggr.Lock()
for _, a := range aggregators {
Expand Down
1 change: 1 addition & 0 deletions go/vt/vttablet/tabletserver/tabletserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ func (tsv *TabletServer) InitACL(tableACLConfigFile string, enforceTableACLConfi

if reloadACLConfigFileInterval != 0 {
ticker := time.NewTicker(reloadACLConfigFileInterval)
defer ticker.Stop()
Comment thread
mattlord marked this conversation as resolved.
Outdated
go func() {
for range ticker.C {
sigChan <- syscall.SIGHUP
Expand Down
1 change: 1 addition & 0 deletions go/vt/vttablet/tabletserver/throttle/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ func (check *ThrottlerCheck) MetricsHealth() map[string](*base.MetricHealth) {
// This runs asynchronously, continuously, and independently of any user interaction
func (check *ThrottlerCheck) SelfChecks(ctx context.Context) {
selfCheckTicker := time.NewTicker(selfCheckInterval)
defer selfCheckTicker.Stop()
go func() {
for range selfCheckTicker.C {
for metricName, metricResult := range check.AggregatedMetrics(ctx) {
Expand Down
4 changes: 4 additions & 0 deletions go/vt/wrangler/testlib/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ func TestBackupRestoreLagged(t *testing.T) {
}(ctx, sourceTablet)

timer := time.NewTicker(1 * time.Second)
defer timer.Stop()
<-timer.C
sourceTablet.FakeMysqlDaemon.CurrentPrimaryPositionLocked(mysql.Position{
GTIDSet: mysql.MariadbGTIDSet{
Expand All @@ -435,6 +436,7 @@ func TestBackupRestoreLagged(t *testing.T) {
})

timer2 := time.NewTicker(5 * time.Second)
defer timer2.Stop()
select {
case err := <-errCh:
require.Nil(t, err)
Expand Down Expand Up @@ -493,6 +495,7 @@ func TestBackupRestoreLagged(t *testing.T) {
}(ctx, destTablet)

timer = time.NewTicker(1 * time.Second)
defer timer.Stop()
<-timer.C
destTablet.FakeMysqlDaemon.CurrentPrimaryPositionLocked(mysql.Position{
GTIDSet: mysql.MariadbGTIDSet{
Expand All @@ -505,6 +508,7 @@ func TestBackupRestoreLagged(t *testing.T) {
})

timer2 = time.NewTicker(5 * time.Second)
defer timer2.Stop()
select {
case err := <-errCh:
require.Nil(t, err)
Expand Down