Skip to content

Commit

Permalink
feat(repeater): address pr comments
Browse files Browse the repository at this point in the history
closes #196
  • Loading branch information
ostridm committed Jun 10, 2024
1 parent 878e8ce commit 504ebfe
Show file tree
Hide file tree
Showing 25 changed files with 768 additions and 398 deletions.
145 changes: 131 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@
"chalk": "^4.1.2",
"ci-info": "^3.3.0",
"content-type": "^1.0.4",
"fast-content-type-parse": "^1.1.0",
"form-data": "^4.0.0",
"http-proxy-agent": "^7.0.2",
"https-proxy-agent": "^7.0.4",
"iconv-lite": "^0.6.3",
"reflect-metadata": "^0.1.13",
"semver": "^7.5.2",
"socket.io-client": "^4.7.5",
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/logger/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export class Logger {
this._logLevel = logLevel;
}

public error(errorOrMessage: string, ...args: any[]): void {
this.write(errorOrMessage, LogLevel.ERROR, ...args);
public error(message: string, ...args: any[]): void {
this.write(message, LogLevel.ERROR, ...args);
}

public warn(message: string, ...args: any[]): void {
Expand Down
4 changes: 1 addition & 3 deletions packages/repeater/src/api/ExecuteRequestEventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ export class ExecuteRequestEventHandler
throw new Error(`Unsupported protocol "${protocol}"`);
}

const response: Response = await runner.run(
new Request({ ...event, correlationIdRegex: event.correlation_id_regex })
);
const response: Response = await runner.run(new Request({ ...event }));

const { statusCode, message, errorCode, body, headers } = response;

Expand Down
24 changes: 0 additions & 24 deletions packages/repeater/src/api/commands/CreateRepeaterRequest.ts

This file was deleted.

12 changes: 0 additions & 12 deletions packages/repeater/src/api/commands/DeleteRepeaterRequest.ts

This file was deleted.

29 changes: 0 additions & 29 deletions packages/repeater/src/api/commands/RegisterRepeaterCommand.ts

This file was deleted.

8 changes: 0 additions & 8 deletions packages/repeater/src/api/commands/index.ts

This file was deleted.

13 changes: 0 additions & 13 deletions packages/repeater/src/api/events/RepeaterStatusEvent.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/repeater/src/api/events/index.ts

This file was deleted.

7 changes: 0 additions & 7 deletions packages/repeater/src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
export {
RepeaterRegisteringError,
RegisterRepeaterResult,
RegisterRepeaterCommandPayload,
RegisterRepeaterCommand
} from './commands';
export { RepeaterStatusEvent } from './events';
export * from './ExecuteRequestEventHandler';
16 changes: 12 additions & 4 deletions packages/repeater/src/bus/DefaultRepeaterBus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class DefaultRepeaterBus implements RepeaterBus {

this.logger.log('Connecting the Bridges');

this.subscribeToEvents();
this.subscribeDiagnosticEvents();

await this.repeaterServer.connect();

Expand All @@ -54,15 +54,23 @@ export class DefaultRepeaterBus implements RepeaterBus {
await this.deploy();

this.logger.log('The Repeater (%s) started', this.repeaterId);

this.subscribeRedeploymentEvent();
}

private async deploy() {
const response = await this.repeaterServer.deploy();
const { repeaterId } = await this.repeaterServer.deploy({
repeaterId: this.repeaterId
});

this._repeaterId = repeaterId;
}

this._repeaterId = response.repeaterId;
private subscribeRedeploymentEvent() {
this.repeaterServer.on(RepeaterServerEvents.CONNECTED, this.deploy);
}

private subscribeToEvents() {
private subscribeDiagnosticEvents() {
this.repeaterServer.on(RepeaterServerEvents.ERROR, this.handleError);

this.repeaterServer.on(
Expand Down
Loading

0 comments on commit 504ebfe

Please sign in to comment.