-
Notifications
You must be signed in to change notification settings - Fork 20
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
WIP: Cancellation #21
Open
bergus
wants to merge
28
commits into
briancavalier:master
Choose a base branch
from
bergus:cancellation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* fix quotes of argument to uglify * not sure whether specifying the path node_modules/mocha/bin/ is an antipattern (some comments by npm authors claim so) but istanbul does not seem to take the PATH into account
just switch "main" of package.json to "dist/creed.node.js" benchmarks will automatically use it
* No more dependency injection of `fulfill`/`resolve` functions * moved around code a bit, especially utils, iteration stuff, combinator functions * simplified some exports that now export a function, not a function factory * Some circular dependencies, mostly completely declarative - Promise - ErrorHandler, inspect: silenceError - Promise - combinators: Future, never, silenceError / race * tests always import `main` unless they test internals
no subscription yet
* implemented token only for Fulfilled, Rejected and Never yet * "need it" is subjective. I've included all obviously cancellable actions, and excluded pure combinators. `merge` should have a token, but it's difficult given its signature * for some reason jsinspect detects a large similarity between Fulfilled and Rejected now, but letting it check for identifiers fixes that (?)
(with full coverage of CancelToken.js) Also fixing some linting issues, typos and bugs in the cancellation code :-)
* then, catch, map, ap, chain (including edge scenarios) * new Promise * delay (with full coverage of everything!) Also fixing some coverage excludes and bugs in the cancellation code :-)
complete with small test suite and full coverage
required some work especially for coroutines
* factored SwappableCancelToken out of coroutine.js * made .requested work as expected on LiveCancelTokens * added tests for all of those * fixed return values of .cancel()
* refactored common elements of CancelTokenPool and CancelTokenReference into CancelTokenCombinator * added CancelToken.race() with CancelTokenRace * tested them
* Now behaving more like .getRejected().catch(...) * taking a token instead of a promise * ...OrCall being the super-easy way to cancel a subscription
* rewrite Action::cancel, Action::tryCall * fix some tests * add tests for finally
* with lots of tests * also add tests and fixes for .untilCancel()
lots of new cancellation tests, some of which are failing
* new Cancelled type that behaves like Rejected everywhere except for trifurcate * token is now private again and vanishes on resolution or settlement * proper support for tokens in future() and Promise() * consistently unsubscribe from tokens on settlement * further simplify (?) Actions by abstracting more things in a CancellableAction class * optmise _resolve() for token cancellation between resolution and settlement * renamed CancelToken::getRejected to getCancelled * fix some cases where Rejections were not tracked
Merged
and include link to official proposal
Fixes #1. * Token composition is still synchronous, as it requires some trickery with returning flat arrays of subscription results. * Subscriptions, finally, trifurcate, and coroutine cancellation all behave asynchronous now, which required some test rewrites. * Action no longer auto-subscribes, as that may cause cancel to be called synchronously before subclass constructors are done with initialisation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #8
Tests fail because of another Buble bug
Please discuss only stylistic issues with the code here, for everything about understanding cancellation and API design choices (method names, behaviour, etc) please open an issue in my repository.
Documentation has now highest priority on my todo list :-)