Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
demoManito committed Sep 2, 2024
1 parent eb13cae commit c07e1f8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions contrib/registry/etcd/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (r *Registry) heartBeat(ctx context.Context, leaseID clientv3.LeaseID, key
if err != nil {
curLeaseID = 0
}
rand.Seed(time.Now().Unix())
randSource := rand.New(rand.NewSource(time.Now().Unix()))

for {
if curLeaseID == 0 {
Expand Down Expand Up @@ -200,7 +200,7 @@ func (r *Registry) heartBeat(ctx context.Context, leaseID clientv3.LeaseID, key
break
}
retreat = append(retreat, 1<<retryCnt)
time.Sleep(time.Duration(retreat[rand.Intn(len(retreat))]) * time.Second)
time.Sleep(time.Duration(retreat[randSource.Intn(len(retreat))]) * time.Second)
}
if _, ok := <-kac; !ok {
// retry failed
Expand Down
6 changes: 3 additions & 3 deletions contrib/registry/kubernetes/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,13 @@ func (s *Registry) Watch(ctx context.Context, name string) (registry.Watcher, er
}
},
Handler: cache.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) {
AddFunc: func(interface{}) {
s.sendLatestInstances(ctx, name, announcement)
},
UpdateFunc: func(oldObj, newObj interface{}) {
UpdateFunc: func(interface{}, interface{}) {
s.sendLatestInstances(ctx, name, announcement)
},
DeleteFunc: func(obj interface{}) {
DeleteFunc: func(interface{}) {
s.sendLatestInstances(ctx, name, announcement)
},
},
Expand Down
2 changes: 1 addition & 1 deletion contrib/registry/nacos/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ func TestRegistry_Watch(t *testing.T) {
},
wantErr: true,
want: nil,
processFunc: func(t *testing.T) {
processFunc: func(*testing.T) {
cancel()
},
},
Expand Down
2 changes: 1 addition & 1 deletion contrib/registry/nacos/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func newWatcher(ctx context.Context, cli naming_client.INamingClient, serviceNam
ServiceName: serviceName,
Clusters: clusters,
GroupName: groupName,
SubscribeCallback: func(services []model.SubscribeService, err error) {
SubscribeCallback: func([]model.SubscribeService, error) {
select {
case w.watchChan <- struct{}{}:
default:
Expand Down

0 comments on commit c07e1f8

Please sign in to comment.