Socket
Socket
Sign inDemoInstall

trooba-toobusy-handler

Package Overview
Dependencies
1
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    trooba-toobusy-handler

Trooba based handler that provides more consistent too busy functionality based on hystrixjs and toobusy-js functionality


Version published
Weekly downloads
1
Maintainers
1
Created
Weekly downloads
 

Readme

Source

trooba-toobusy-handler

The module provides trooba too-busy handler. The handler is based on hystrix-too-busy module

codecov Build Status NPM Downloads Known Vulnerabilities

Install

$ npm install trooba-toobusy-handler -S

Usage

const toobusy = require('trooba-toobusy-handler');

toobusy.configure({
    latencyThreshold: 70,
    interval: 500,
    default: {
        circuitBreakerErrorThresholdPercentage: 50,
        circuitBreakerRequestVolumeThreshold: 20,
        circuitBreakerSleepWindowInMilliseconds: 5000
    }
});

require('trooba')
// optional: command resolver used by toobusy
.use(pipe => {
    pipe.on('request', request => {
        pipe.context.command =
            request.path === '/' ? 'homeCommand' : 'otherCommand';
    });
})
// add toobusy
.use(toobusy)
// add http transport
.use('trooba-http-transport', {
    protocol: 'http:',
    hostname: 'www.google.com'
})
.build('client:default')
.get({
    q: 'nike'
})
.set('some', 'header')
.end(function (err, response) {
    console.log(err, response && response.body)
});

Keywords

FAQs

Last updated on 02 Jun 2017

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc