Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disposer is not invoked when the resource construction contains two nested then's #433

hvrauhal opened this issue Jan 12, 2015 · 2 comments


Copy link

In the following code, resource 2 is not disposed at all with bluebird versions > 2.4.3:

var BPromise = require('bluebird');

function workingGetResource() {
  return BPromise.resolve(1).then(function (x) {
    console.log('Providing resource', x);
    return BPromise.resolve(x)
  }).disposer(function (y) {
    console.log('Disposing resource', y);

function failingGetResource() {
  return BPromise.resolve(2).then(function (x) {
    return BPromise.resolve(x).then(function (y) {
      console.log('Providing resource', y);
      return y
  }).disposer(function (z) {
    console.log('Disposing resource', z);

BPromise.using(workingGetResource(), function (r) {
  console.log('Using resource', r)
}).then(function () {
  return BPromise.using(failingGetResource(), function (r) {
    console.log('Using resource ' + r + ' that is only disposed when bluebird <= 2.4.2')
Copy link
Contributor Author

Here's a patch with a failing test:

Copy link

Thanks, fixed with the 2.6.3 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

2 participants