Browse Source

Change socket path in IPC services to use a constant rather than a getter in the microservice IPC package

dev
David Ludwig 4 years ago
parent
commit
fce43dc18c
3 changed files with 4 additions and 4 deletions
  1. +1
    -1
      packages/microservice/src/ipc/AbstractIpcService.ts
  2. +1
    -1
      packages/microservice/src/ipc/IpcClientService.ts
  3. +2
    -2
      packages/microservice/src/ipc/IpcServerService.ts

+ 1
- 1
packages/microservice/src/ipc/AbstractIpcService.ts View File

@ -18,7 +18,7 @@ export default abstract class AbstractIpcService<M extends Microservice = Micros
/**
* The path to the socket file
*/
protected abstract get socketPath(): string;
protected abstract readonly SOCKET_PATH: string;
/**
* Add a message handler for the service


+ 1
- 1
packages/microservice/src/ipc/IpcClientService.ts View File

@ -41,7 +41,7 @@ export abstract class IpcClientService<M extends Microservice = Microservice> ex
public bootIpc(ipc: IPC) {
// Connect to the server
return new Promise<void>((resolve, reject) => {
this.rawIpcInstance!.connectTo(this.NAME, this.socketPath, () => {
this.rawIpcInstance!.connectTo(this.NAME, this.SOCKET_PATH, () => {
this.__isConnected = true;
this.__requestId = 0;
this.__socket = ipc!.of[this.NAME];


+ 2
- 2
packages/microservice/src/ipc/IpcServerService.ts View File

@ -35,9 +35,9 @@ export abstract class IpcServerService<M extends Microservice = Microservice> ex
public bootIpc(ipc: IPC) {
return new Promise<void>(async (resolve) => {
// Create the socket directory if it doesn't exist
await mkdir(dirname(this.socketPath), { recursive: true });
await mkdir(dirname(this.SOCKET_PATH), { recursive: true });
// Serve the IPC server
ipc.serve(this.socketPath, () => {
ipc.serve(this.SOCKET_PATH, () => {
this.__server = ipc.server;
this.installMessageHandlers();
resolve();


Loading…
Cancel
Save