beardon / mws-api

Amazon Marketplace Web Services client for Node.js.
79 stars 55 forks source link

Do not enable longStackTraces, consider using Promise.getNewLibraryCopy #88

Closed dciccale closed 7 years ago

dciccale commented 7 years ago

Should not globally set longStackTraces option from bluebird (https://github.com/beardon/mws-api/blob/master/lib/client.js#L15) because it will be set in bluebird singleton instance itself, forcing my or any project to have this enabled even in the production environment. Which apparently it can have a 2x-3x performance impact http://bluebirdjs.com/docs/api/promise.config.html#comment-3322469547

Consider using Promise.getNewLibraryCopy http://bluebirdjs.com/docs/api/promise.getnewlibrarycopy.html to create a custom instance and enable longStackTraces to that instance.

const Promise = require('bluebird');
console.log(Promise.hasLongStackTraces()); // false (bluebird's default)
const mws = require('mws-api');
console.log(Promise.hasLongStackTraces()); // true (after importing mws-api)
dciccale commented 7 years ago

fixed in #91