Skip to content

Commit

Permalink
fix: updated eslint errors
Browse files Browse the repository at this point in the history
/src/middlewares/timeout.js
/src/transit.js
  • Loading branch information
JS-AK committed Jan 14, 2025
1 parent db4f7ef commit cd743bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/middlewares/timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = function (broker) {
});

if (ctx.params instanceof Stream) {
ctx.params.emit('moleculer-timeout-middleware', ctx.options.timeout)
ctx.params.emit("moleculer-timeout-middleware", ctx.options.timeout);
}

err = new RequestTimeoutError({ action: actionName, nodeID });
Expand Down
16 changes: 8 additions & 8 deletions src/transit.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,12 +551,12 @@ class Transit {

this.pendingReqStreams.set(payload.id, { sender: payload.sender, stream: pass });

pass.on('moleculer-timeout-middleware', (timeout) => {
pass.on("moleculer-timeout-middleware", (timeout) => {

Check failure on line 554 in src/transit.js

View workflow job for this annotation

GitHub Actions / common

Replace `(timeout)` with `timeout`
setTimeout(() => {
this.pendingReqStreams.delete(payload.id);
this._destroyStreamIfPossible(pass, `Pending request stream ${payload.id} have been closed by timeout ${timeout} ms`)
this._destroyStreamIfPossible(pass, `Pending request stream ${payload.id} have been closed by timeout ${timeout} ms`);

Check failure on line 557 in src/transit.js

View workflow job for this annotation

GitHub Actions / common

Replace `pass,·`Pending·request·stream·${payload.id}·have·been·closed·by·timeout·${timeout}·ms`` with `⏎↹↹↹↹↹↹pass,⏎↹↹↹↹↹↹`Pending·request·stream·${payload.id}·have·been·closed·by·timeout·${timeout}·ms`⏎↹↹↹↹↹`
}, 1000);
})
});
}

if (payload.seq > pass.$prevSeq + 1) {
Expand Down Expand Up @@ -872,11 +872,11 @@ class Transit {
this.pendingRequests.set(ctx.id, request);

if (request.stream) {
const pass = request.ctx.params
const pass = request.ctx.params;

pass.on('moleculer-timeout-middleware', (timeout) => {
this._destroyStreamIfPossible(pass, `Request stream ${ctx.id} have been closed by timeout ${timeout} ms`)
})
pass.on("moleculer-timeout-middleware", (timeout) => {

Check failure on line 877 in src/transit.js

View workflow job for this annotation

GitHub Actions / common

Replace `(timeout)` with `timeout`
this._destroyStreamIfPossible(pass, `Request stream ${ctx.id} have been closed by timeout ${timeout} ms`);

Check failure on line 878 in src/transit.js

View workflow job for this annotation

GitHub Actions / common

Replace `pass,·`Request·stream·${ctx.id}·have·been·closed·by·timeout·${timeout}·ms`` with `⏎↹↹↹↹↹pass,⏎↹↹↹↹↹`Request·stream·${ctx.id}·have·been·closed·by·timeout·${timeout}·ms`⏎↹↹↹↹`
});
}

// Publish request
Expand Down Expand Up @@ -1118,7 +1118,7 @@ class Transit {
*/
_destroyStreamIfPossible(stream, errorMessage) {
if (!stream.destroyed && stream.destroy) {
stream.on('error', (err) => this.logger.error(err.message))
stream.on("error", (err) => this.logger.error(err.message));

Check failure on line 1121 in src/transit.js

View workflow job for this annotation

GitHub Actions / common

Replace `(err)` with `err`
stream.destroy(new Error(errorMessage));
}
}
Expand Down

0 comments on commit cd743bc

Please sign in to comment.