Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

feathers-opossum

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

feathers-opossum

A service plugin for opossum

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

feathers-opossum

Build Status Coverage Status dependencies Status Known Vulnerabilities

feathers-opossum is a circuit breaker for Feathers services. It implements the opossum module.

npm install feathers-opossum --save

API

service(Service, serviceOptions, opossumOptions)

Example:

const service = require('service');
const opossumService = require('feathers-opossum');

const options = {
  opossum: {
    timeout: 3000,
    errorThresholdPercentage: 50,
    resetTimeout: 30000
  },
  fallback: () => {
    return 'Sorry, out of service right now';
  },
  events: {
    fallback: result => reportFallbackEvent(result),
  }
  methods: ['find', 'get']
};

const circuitedService = opossumService(service, {id:'_id', paginate: {max:10 }, options);

app.use('/may-fail', circuitedService);

Options:

  • Service (required) - The main service
  • opossum.timeout (optional, default: 3000) - If our function takes longer than trigger a failure
  • opossum.errorThresholdPercentage (optional, default: 50) - When this ratio on requests fail, trip the circuit
  • opossum.resetTimeout (optional, default: 30000) - After this try again.
  • fallback - A fallback function that will be executed in the event of failure.
  • events - Opossum event listener.

Options per Service Method:

  const options = {
      find: {
        opossum: {
          timeout: 5000,
          errorThresholdPercentage: 50,
          resetTimeout: 30000
        }
        fallback: () => {
          return 'Sorry, out of service right now';
        },
        events: {
          fallback: result => reportFallbackEvent(result),
        }
      },
      get: {
        opossum: {
          timeout: 1000,
          errorThresholdPercentage: 50,
          resetTimeout: 30000
        }
        fallback: () => {
          return 'Sorry, out of service right now';
        },
        events: {
          fallback: result => reportFallbackEvent(result),
        }
      }
    };

Changelog

1.0.0

  • implement opossum events
  • add event test

0.1.0

  • publish

...

License

Copyright (c) 2020

Licensed under the MIT license.

Keywords

FAQs

Package last updated on 01 Jun 2020

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc