Skip to content

Commit

Permalink
Fix unstable TestHealClient_Request (networkservicemesh#864)
Browse files Browse the repository at this point in the history
* Fix race in networkservice/core/adapters/monitor_server_to_client.go

Signed-off-by: Danil Uzlov <DanilUzlov@yandex.ru>

* fix copyright notice

Signed-off-by: Danil Uzlov <DanilUzlov@yandex.ru>

* fix copyright notice

Signed-off-by: Danil Uzlov <DanilUzlov@yandex.ru>
  • Loading branch information
d-uzlov authored Apr 23, 2021
1 parent 8fe3d10 commit 5c10e50
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/networkservice/core/adapters/monitor_server_to_client.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2020 Cisco and/or its affiliates.
//
// Copyright (c) 2021 Doc.ai and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -18,6 +20,7 @@ package adapters

import (
"context"
"runtime"

"github.com/networkservicemesh/api/pkg/api/networkservice"
"google.golang.org/grpc"
Expand All @@ -41,5 +44,8 @@ func (m *monitorServerToClient) MonitorConnections(ctx context.Context, selector
go func() {
_ = m.server.MonitorConnections(selector, srv)
}()
for len(eventCh) == 0 {
runtime.Gosched()
}
return eventchannel.NewMonitorConnectionMonitorConnectionsClient(ctx, eventCh), nil
}

0 comments on commit 5c10e50

Please sign in to comment.