Skip to content

Commit

Permalink
nit(refactor): remove the unnecessary for loop
Browse files Browse the repository at this point in the history
longhorn-9438

Signed-off-by: Phan Le <phan.le@suse.com>
  • Loading branch information
PhanLe1010 committed Sep 12, 2024
1 parent eea871e commit bce3e41
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
7 changes: 2 additions & 5 deletions pkg/disk/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,8 @@ func NewServer(ctx context.Context, spdkEnabled bool, spdkServiceAddress string)
}

func (s *Server) startMonitoring() {
for {
<-s.ctx.Done()
logrus.Infof("%s: stopped monitoring due to the context done", types.DiskGrpcService)
break
}
<-s.ctx.Done()
logrus.Infof("%s: stopped monitoring due to the context done", types.DiskGrpcService)
}

func (s *Server) VersionGet(ctx context.Context, req *emptypb.Empty) (*rpc.DiskVersionResponse, error) {
Expand Down
7 changes: 2 additions & 5 deletions pkg/instance/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,8 @@ func NewServer(ctx context.Context, logsDir, processManagerServiceAddress, spdkS
}

func (s *Server) startMonitoring() {
for {
<-s.ctx.Done()
logrus.Infof("%s: stopped monitoring due to the context done", types.InstanceGrpcService)
break
}
<-s.ctx.Done()
logrus.Infof("%s: stopped monitoring due to the context done", types.InstanceGrpcService)
}

func (s *Server) VersionGet(ctx context.Context, req *emptypb.Empty) (*rpc.VersionResponse, error) {
Expand Down
7 changes: 2 additions & 5 deletions pkg/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,8 @@ func NewProxy(ctx context.Context, logsDir, diskServiceAddress, spdkServiceAddre
}

func (p *Proxy) startMonitoring() {
for {
<-p.ctx.Done()
logrus.Infof("%s: stopped monitoring due to the context done", types.ProxyGRPCService)
break
}
<-p.ctx.Done()
logrus.Infof("%s: stopped monitoring due to the context done", types.ProxyGRPCService)
}

func (p *Proxy) ServerVersionGet(ctx context.Context, req *rpc.ProxyEngineRequest) (resp *rpc.EngineVersionProxyResponse, err error) {
Expand Down

0 comments on commit bce3e41

Please sign in to comment.