AllegiantAir / g4js-cognos

Node.js client for Cognos application integration utilizing CMS.
MIT License
5 stars 9 forks source link

Temporary fix for event listener leak for requests where cognos takes longer to return the report #4

Closed helloanoop closed 8 years ago

helloanoop commented 8 years ago

Please see ticket comments for further details

nesbert commented 8 years ago

Changes look good... but would like to discuss making maxListeners and maxRedirects configurable.

nesbert commented 8 years ago

What about the code below? Will allow us to override these settings on demand without changing method signatures.

` // add defaults object in file header of lib/cms/index.js var defaults = { maxRedirects: 10, maxListeners: require('events').EventEmitter.prototype._maxListeners };

// inside get promise function ops.maxRedirects = ops.maxRedirects || defaults.maxRedirects; require('events').EventEmitter.prototype._maxListeners = ops.maxRedirects || defaults.maxListeners; `

nesbert commented 8 years ago

See https://jsfiddle.net/nesbert/5rpyscnf/

Usage...

Cms.defaults.maxRedirects = 2;

var report = new Cms(serviceUrl, serviceNamespace, serviceUsername, servicePassword);
`
nesbert commented 8 years ago

Good stuff cutting a release now.