New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

loopbusy

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loopbusy

Middleware to send 503s and keep your server alive when it's too busy to queue more requests

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
4
-20%
Maintainers
1
Weekly downloads
 
Created
Source

Loopbusy

Middleware to send 503s and keep your server alive when it's too busy to queue more requests.

var app = express();

app
  .use(loopbusy())
  .get('/', function sendOk(req, res, next) {
    res.send('ok');
  })
  .use(function handleErrors(err, req, res, next) {
    res.status(err.status).send('err');
  });

Loopbusy uses the event-loop-lag module to determine when the event loop is piling up requests.

When lag passes a threshold, loopbusy passes 503 errors to your middleware stack so your app can stay alive for some users instead of falling over for all users.

Options

loopbusy(maxLag, pollingInterval);

Max Lag

loopbusy(500);

The maximum lag (in ms) of your event loop.

Defaults to 250.

Interval

loopbusy(null, 3000);

The polling interval (in ms) for measuring your event loop. Shorter values catch business faster at the cost of additional overhead.

Defaults to 1000.

Tests

npm test

Keywords

503

FAQs

Package last updated on 04 Sep 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts