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

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

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

Comments

Projects
None yet
3 participants
@ben-page
Contributor

ben-page commented Aug 7, 2016

  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

This comment has been minimized.

Show comment
Hide comment
@overlookmotel

overlookmotel Aug 7, 2016

Contributor

May be related to issue #1177

Contributor

overlookmotel commented Aug 7, 2016

May be related to issue #1177

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