Skip to content

Commit 07e1547

Browse files
authored
fix: Propagate logger to sidecar awaiting method (#358)
Propagate logger for sidecar start Signed-off-by: Shubham Sharma <[email protected]> Signed-off-by: Shubham Sharma <[email protected]>
1 parent be0277d commit 07e1547

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

src/implementation/Client/DaprClient.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,7 @@ export default class DaprClient {
149149
return new DaprClient(client.getClientHost(), client.getClientPort(), client.getClientCommunicationProtocol(), client.getOptions());
150150
}
151151

152-
static async awaitSidecarStarted(fnIsSidecarStarted: () => Promise<boolean>): Promise<void> {
153-
const logger = new Logger("DaprClient", "DaprClient");
154-
152+
static async awaitSidecarStarted(fnIsSidecarStarted: () => Promise<boolean>, logger: Logger): Promise<void> {
155153
// Dapr will probe every 50ms to see if we are listening on our port: https://github.com/dapr/dapr/blob/a43712c97ead550ca2f733e9f7e7769ecb195d8b/pkg/runtime/runtime.go#L1694
156154
// if we are using actors we will change this to 4s to let the placement tables update
157155
let isStarted = await fnIsSidecarStarted();

src/implementation/Client/GRPCClient/GRPCClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export default class GRPCClient implements IClient {
115115
}
116116

117117
async _startAwaitSidecarStarted(): Promise<void> {
118-
await DaprClient.awaitSidecarStarted(async () => await GRPCClientSidecar.isStarted(this));
118+
await DaprClient.awaitSidecarStarted(async () => await GRPCClientSidecar.isStarted(this), this.logger);
119119
}
120120

121121
/**

src/implementation/Client/HTTPClient/HTTPClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export default class HTTPClient implements IClient {
113113
}
114114

115115
async _startAwaitSidecarStarted(): Promise<void> {
116-
await DaprClient.awaitSidecarStarted(async () => await HTTPClientSidecar.isStarted(this));
116+
await DaprClient.awaitSidecarStarted(async () => await HTTPClientSidecar.isStarted(this), this.logger);
117117
}
118118

119119
async stop(): Promise<void> {

0 commit comments

Comments
 (0)