Skip to content

Commit

Permalink
Fix reconnect logging and memleak
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalCz committed Mar 21, 2024
1 parent 99b5ea4 commit 519c6e6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/runner/src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export class Runner<X extends AppConfig> implements IComponent {
private handleSetRequest(data: SetMessageData) {
if (data.logLevel) {
this.logger.logLevel = data.logLevel;

if (this._context)
this._context.logger.logLevel = data.logLevel;
}
Expand Down
7 changes: 4 additions & 3 deletions packages/utility/src/typeguards/dto/instance-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function isStartSequenceDTO(arg: any): arg is StartSequenceDTO {
return true;
}

// eslint-disable-next-line complexity
export function isStartSequenceEndpointPayloadDTO(arg: any): arg is StartSequenceEndpointPayloadDTO {
if (typeof arg !== "object") {
throw new Error("DTO is not an object");
Expand All @@ -41,7 +42,7 @@ export function isStartSequenceEndpointPayloadDTO(arg: any): arg is StartSequenc
throw new Error("DTO instanceId is not valid string");
}
if (logLevel && !LogLevelStrings.includes(logLevel)) {
throw new Error("DTO logLevel is not valid");
throw new Error("DTO logLevel is not valid");
}
return true;
}
Expand All @@ -53,9 +54,9 @@ export function isSetSequenceEndpointPayloadDTO(arg: any): arg is SetSequenceEnd
const { logLevel, ...rest } = arg;

if (logLevel && !LogLevelStrings.includes(logLevel)) {
throw new Error("DTO logLevel is not valid");
throw new Error("DTO logLevel is not valid");
}
if (Object.values(rest).length > 0)
if (Object.values(rest).length > 0)
throw new Error(`DTO has unknown ${Object.keys(rest)} keys`);

return true;
Expand Down
3 changes: 2 additions & 1 deletion packages/utility/src/typeguards/dto/sequence-start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function isStartSequenceDTO(arg: any): arg is StartSequenceDTO {
return true;
}

// eslint-disable-next-line complexity
export function isStartSequenceEndpointPayloadDTO(arg: any): arg is StartSequenceEndpointPayloadDTO {
if (typeof arg !== "object") {
throw new Error("DTO is not an object");
Expand All @@ -41,7 +42,7 @@ export function isStartSequenceEndpointPayloadDTO(arg: any): arg is StartSequenc
throw new Error("DTO instanceId is not valid string");
}
if (logLevel && !LogLevelStrings.includes(logLevel)) {
throw new Error("DTO logLevel is not valid");
throw new Error("DTO logLevel is not valid");
}
return true;
}

0 comments on commit 519c6e6

Please sign in to comment.