Skip to content

Commit

Permalink
refactor(microservices): improve speed of grpc server initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
yjiq150 committed Apr 3, 2024
1 parent 8b4dbb3 commit 9dec08e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/microservices/server/server-grpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -560,14 +560,19 @@ export class ServerGrpc extends Server implements CustomTransportStrategy {
? deepDefinition.service !== false
: false;

// grpc namespace object does not have 'format' or 'service' properties defined
const isFormatDefined =
deepDefinition && !isUndefined(deepDefinition.format);

if (isServiceDefined && isServiceBoolean) {
accumulator.push({
name: nameExtended,
service: deepDefinition,
});
}
// Continue recursion until objects end or service definition found
else {
} else if (isFormatDefined) {
// Do nothing
} else {
// Continue recursion for namespace object until objects end or service definition found
this.collectDeepServices(nameExtended, deepDefinition, accumulator);
}
}
Expand Down

0 comments on commit 9dec08e

Please sign in to comment.