From 57c748657ad24fd8ea0ca88202882540b4090b45 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Wed, 16 Dec 2020 01:38:57 +0000 Subject: [PATCH] fix(core): update --- test/test.expressserver.ts | 19 ++++++++++++++----- ts/smartsocket.classes.socketconnection.ts | 2 +- ts/smartsocket.classes.socketrequest.ts | 6 +++--- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/test/test.expressserver.ts b/test/test.expressserver.ts index 6be955f..0c03798 100644 --- a/test/test.expressserver.ts +++ b/test/test.expressserver.ts @@ -15,7 +15,7 @@ let testSocketFunction1: smartsocket.SocketFunction; let myseServer: smartexpress.Server; const testConfig = { - port: 3000, + port: 3005, }; // class smartsocket @@ -87,10 +87,19 @@ tap.test('2 clients should connect in parallel', async () => { }); tap.test('should be able to make a functionCall from client to server', async () => { - const response = await testSmartsocketClient.serverCall('testFunction1', { - value1: 'hello', - }); - console.log(response); + const totalCycles = 20000 + let counter = 0; + let startTime = Date.now(); + while (counter < totalCycles) { + const response = await testSmartsocketClient.serverCall('testFunction1', { + value1: 'hello', + }); + if (counter % 100 === 0) { + console.log(`processed 100 more messages in ${Date.now() - startTime}ms. ${totalCycles - counter} messages to go.`); + startTime = Date.now(); + }; + counter++; + } }); tap.test('should be able to make a functionCall from server to client', async () => {}); diff --git a/ts/smartsocket.classes.socketconnection.ts b/ts/smartsocket.classes.socketconnection.ts index 15e7add..14bdfbc 100644 --- a/ts/smartsocket.classes.socketconnection.ts +++ b/ts/smartsocket.classes.socketconnection.ts @@ -143,7 +143,7 @@ export class SocketConnection { } }); this.socket.on('functionResponse', (dataArg: ISocketRequestDataObject) => { - logger.log('info', `received response for request with id ${dataArg.shortId}`); + // logger.log('info', `received response for request with id ${dataArg.shortId}`); const targetSocketRequest = SocketRequest.getSocketRequestById( this.smartsocketRef, dataArg.shortId diff --git a/ts/smartsocket.classes.socketrequest.ts b/ts/smartsocket.classes.socketrequest.ts index 7c80c75..08c4ba5 100644 --- a/ts/smartsocket.classes.socketrequest.ts +++ b/ts/smartsocket.classes.socketrequest.ts @@ -90,7 +90,7 @@ export class SocketRequest) { - logger.log('info', 'handling response!'); + // logger.log('info', 'handling response!'); this.done.resolve(responseDataArg.funcCallData); this.smartsocketRef.socketRequests.remove(this); } @@ -110,11 +110,11 @@ export class SocketRequest { - logger.log('info', 'got resultData. Sending it to requesting party.'); + // logger.log('info', 'got resultData. Sending it to requesting party.'); const responseData: ISocketRequestDataObject = { funcCallData: resultData, shortId: this.shortid,