Skip to content

Commit

Permalink
Merge branch 'master' into add_http_client_api_for_jenkins
Browse files Browse the repository at this point in the history
  • Loading branch information
HuSharp authored Dec 13, 2023
2 parents 38daa87 + ab97b9a commit 63281b1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions server/grpc_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,11 @@ func (s *GrpcServer) GetMinTSFromTSOService(dcLocation string) (*pdpb.Timestamp,

// Get the minimal timestamp from the TSO servers/pods
var mutex syncutil.Mutex
resps := make([]*tsopb.GetMinTSResponse, len(addrs))
resps := make([]*tsopb.GetMinTSResponse, 0)
wg := sync.WaitGroup{}
wg.Add(len(addrs))
for idx, addr := range addrs {
go func(idx int, addr string) {
for _, addr := range addrs {
go func(addr string) {
defer wg.Done()
resp, err := s.getMinTSFromSingleServer(s.ctx, dcLocation, addr)
if err != nil || resp == nil {
Expand All @@ -342,8 +342,8 @@ func (s *GrpcServer) GetMinTSFromTSOService(dcLocation string) (*pdpb.Timestamp,
}
mutex.Lock()
defer mutex.Unlock()
resps[idx] = resp
}(idx, addr)
resps = append(resps, resp)
}(addr)
}
wg.Wait()

Expand Down

0 comments on commit 63281b1

Please sign in to comment.