Git Product home page Git Product logo

creed's People

Contributors

bergus avatar briancavalier avatar davidchase avatar gitter-badger avatar greenkeeperio-bot avatar unscriptable avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

creed's Issues

No synchronous callbacks

Currently cancellation callbacks from subscribe, subscribeOrCall, finally and trifurcate are called synchronously from cancel(โ€ฆ). They should not.
This was done to a) immediately cancel involved promises and actions (not just by .requested) and b) create and flatten the array of feedback promises from the appropriate sources. See bergus/promise-cancellation#7 and bergus/promise-cancellation#9.

Fix memory leaks for token composition

See the case made by @stefanpenner in tc39/proposal-cancelable-promises#52

In many situations, a long-lived cancellation token (passed in by the caller) is combined with a short-lived token, e.g. in the "last" example or for a timeout:

function withTimeout(action, t) {
    return function(...args) {
        const token = args.pop();
        const timeout = new CancelToken(cancel => setTimeout(cancel, t, "timeout"));
        return action.call(this, ...args, token.concat(timeout));
    };
}

When the action is long over, and the combined token is no longer relevant to anyone, the token still holds are reference to it.
Todo:

  • ensure that it is dropped, or at least not more than a constant amount of references are kept (though not ideal for tree-like dependencies).
  • write refcounting test

Add TimeoutToken

A token that is cancelled after a timeout is simple:

new CancelToken(cancel => setTimeout(cancel, t, "timeout"))

However, this keeps the setTimeout active even when the token is no longer needed and all promises that might be cancelled by it are already resolved. This could keep a process alive even when there's nothing to do any more.
Implement a TimeoutToken that does not need any resources while nobody is listening, i.e. simply stores the end time and calls setTimeout/clearTimeout as necessary.
In node, this also could be achieved by a simple unref call.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.