Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): missing check for double removal of unresponsive module #850

Merged
merged 2 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,18 @@ export class ServiceMonitor {

private async monitorModules() {
for (const module of this._serviceRegistry.getRegisteredModules()) {
const registeredModule = this._serviceRegistry.getModule(module)!;
const registeredModule = this._serviceRegistry.getModule(module);
if (!registeredModule) continue;
try {
await this.healthCheckService(module, registeredModule.address);
} catch (e) {
this.handleUnresponsiveModule(
module,
registeredModule.address,
HealthCheckStatus.SERVICE_UNKNOWN,
);
if (this._serviceRegistry.getModule(module)) {
this.handleUnresponsiveModule(
module,
registeredModule.address,
HealthCheckStatus.SERVICE_UNKNOWN,
);
}
}
}
this.moduleRegister.emit('serving-modules-update');
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/config-manager/service-discovery/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ export class ServiceDiscovery {
this.grpcSdk.createModuleClient(moduleName, moduleUrl);
}
} catch (e) {
ConduitGrpcSdk.Logger.error(`SD: failed to recover: ${moduleName} ${moduleUrl}`);
ConduitGrpcSdk.Logger.error(`SD: recovery error: ${e}`);
throw new Error('Failed to register unresponsive module');
}
const healthStatus = healthResponse.status as unknown as HealthCheckStatus;
Expand Down
Loading