You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
first off, thank you for this package, it's come in handy several times and always does a great job.
Documentation, however, could be expanded, and I have a question regarding its use in an ExpressJs middleware.
I would like to use "blocked" to investigate the cause of some timeouts we are experiencing in a controller.
I was wondering if I could do something like:
create a middleware like:
import { Request, Response, NextFunction } from 'express';
import * as blocked from 'blocked-at';
export default (_req: Request, _res: Response, next: NextFunction): void => {
blocked(
(time: any, stack: any) => {
console.log(`Blocked for ${time}ms, operation started here:`, { stack });
},
{ threshold: 1000 },
);
next();
};
and append this to our route handler
import { Router } from 'express';
import * as RestController from '.';
import ApiKeyAuth from '../../authorization/api-key-auth';
import blocked from '../../middleware/blocked';
router.post('/users', ApiKeyAuth, blocked, RestController.createUser);
I am testing this out with jMeter right now, and I have contrasting feelings on the effectiveness, what are your thoughts on this?
The text was updated successfully, but these errors were encountered:
Hi there,
first off, thank you for this package, it's come in handy several times and always does a great job.
Documentation, however, could be expanded, and I have a question regarding its use in an ExpressJs middleware.
I would like to use "blocked" to investigate the cause of some timeouts we are experiencing in a controller.
I was wondering if I could do something like:
I am testing this out with jMeter right now, and I have contrasting feelings on the effectiveness, what are your thoughts on this?
The text was updated successfully, but these errors were encountered: