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

cls-q

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cls-q

Make your promises play nice with the continuation-local-storage module.

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

patch Q to work better with continuation-local storage

Certain kinds of asynchronous operations don't play nicely with Q and continuation-local storage. This shim was put together to make CLS and Q work better with node-redis; there may be other modules that are doing funky things with asynchronous execution that require it. All it does is bind callbacks passed to promise.then so that the active CLS contexts at the time then() was called are correctly set.

It only binds to one namespace at a time:

var cls = require('continuation-local-storage');
var ns = cls.createNamespace('NODESPACE');

var Q = require('q');

// load shim
var patchQ = require('cls-q');
patchQ(ns);

You can bind to more than one, but the overhead of doing so will start to add up quickly.

tests

The tests assume a Redis server is up and running on localhost on the standard port. Work is underway to find a test case that doesn't require any external dependencies.

Keywords

FAQs

Package last updated on 09 Jan 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

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