Skip to content

Commit 1070851

Browse files
Utilize isSidecarStarted in health
Signed-off-by: Xavier Geerinck <[email protected]>
1 parent f950817 commit 1070851

File tree

1 file changed

+1
-17
lines changed
  • src/implementation/Client/GRPCClient

1 file changed

+1
-17
lines changed

src/implementation/Client/GRPCClient/health.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ limitations under the License.
1313

1414
import GRPCClient from './GRPCClient';
1515
import IClientHealth from '../../../interfaces/Client/IClientHealth';
16-
import { GetMetadataResponse } from '../../../proto/dapr/proto/runtime/v1/dapr_pb';
17-
import { Empty } from "google-protobuf/google/protobuf/empty_pb";
1816

1917
// https://docs.dapr.io/reference/api/health_api/
2018
export default class GRPCClientHealth implements IClientHealth {
@@ -26,20 +24,6 @@ export default class GRPCClientHealth implements IClientHealth {
2624

2725
// There is no gRPC implementation of /healthz, so we try to fetch the metadata
2826
async isHealthy(): Promise<boolean> {
29-
return new Promise((resolve, _reject) => {
30-
const client = this.client.getClient();
31-
32-
try {
33-
client.getMetadata(new Empty(), (err, _res: GetMetadataResponse) => {
34-
if (err) {
35-
return resolve(false);
36-
}
37-
38-
return resolve(true);
39-
});
40-
} catch (e) {
41-
return resolve(false);
42-
}
43-
});
27+
return this.client.isSidecarStarted();
4428
}
4529
}

0 commit comments

Comments
 (0)