isCancelled() is false after calling cancel() #1187

Closed
ben-page opened this Issue Aug 7, 2016 · 1 comment

Projects

None yet

3 participants

@ben-page
Contributor
ben-page commented Aug 7, 2016 edited
  1. What version of bluebird is the issue happening on? 3.4.1

  2. What platform and version? (For example Node.js 0.12 or Google Chrome 32) Node.js 6.3.1

  3. Did this issue happen with earlier version of bluebird? Yes

Description

Based on the examples in the docs, one would expect isCancelled() to be false after cancellation but this does not seem to be the case.

Example

const Promise = require('bluebird');
Promise.config({
    cancellation: true
});

setTimeout(() => {
    cancellablePromise.cancel();
    console.log('1. isCancelled = ' + cancellablePromise.isCancelled());
}, 100);

const cancellablePromise = Promise.delay(300)
    .finally(() => {
        console.log('2. isCancelled = ' + cancellablePromise.isCancelled());
    });

console.log('isCancellable = ' + cancellablePromise.isCancellable());

cancellablePromise
    .finally(() => {
        console.log('3. isCancelled = ' + cancellablePromise.isCancelled());
    });

Output

isCancellable = true
1. isCancelled = false
2. isCancelled = false
3. isCancelled = true

Is this the intended behavior or are the docs wrong?

@overlookmotel
Contributor

May be related to issue #1177

@petkaantonov petkaantonov added a commit that closed this issue Aug 24, 2016
@petkaantonov fixes #1187 8f2adb9
@petkaantonov petkaantonov added a commit that referenced this issue Aug 24, 2016
@petkaantonov fixes #1187 77f7711
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment