Commit Graph

288 Commits

Author SHA1 Message Date
Doug Stein
ca4ee531ef Fix for #1049: Some tests seem to depend on dispatching that PromiseKit should perhaps not be doing
The cancellable promise bridge now runs 'catch' on the current thread dispatcher.

Updated tests for the change.
2019-04-20 15:21:45 -07:00
Garth Snyder
c52bca7258 Fix a couple of incorrect map vs. return wrapper settings 2019-04-08 09:55:34 -07:00
Garth Snyder
46517fee00 Duplicate Nathan's partial-catch updates for cancellable promises, update tests 2019-04-07 23:11:35 -07:00
Nathan Hosselton
43394a7fe7 Include error param in catch/recover(only:) bodies
rolls back 193ecbc1
2019-04-07 22:16:38 -07:00
Nathan Hosselton
342c059a46 Allow throwing from recover(only: E) closures 2019-04-07 22:16:33 -07:00
Nathan Hosselton
f634434ad0 Require parameter name only:
so…
`catch(Error.value)` -> `catch(only: Error.value)`
2019-04-07 22:16:27 -07:00
Garth Snyder
3e21581aba Make Dispatcher type implementation classes final 2019-04-07 21:42:59 -07:00
Garth Snyder
bc28be9e91 Use CurrentThreadDispatcher directly in case where exact type isn't known 2019-04-07 21:42:59 -07:00
Garth Snyder
a10e6ea8dc Systematize wrappers, omit duplication, move to subdirectory 2019-04-07 21:42:59 -07:00
Garth Snyder
43662ff267 Allow recover() closures to throw even on specific error 2019-04-07 21:42:20 -07:00
Garth Snyder
71ffdce045 Add cauterize() for cascading finalizers 2019-04-07 21:42:20 -07:00
Garth Snyder
a64f4c24c8 Edit inline documentation for catchables 2019-04-07 21:42:20 -07:00
Garth Snyder
0ca0b8bc28 Move cancellation-related implementation files to subdirectory 2019-04-07 21:42:20 -07:00
Garth Snyder
3cfc3a7893 Rename CancellableTask.swift to Cancellable.swift (match protocol) 2019-04-07 21:42:20 -07:00
Max Howell
a8715931a9
Merge pull request #1031 from mxcl/v7-travis-swift-5-GM
[travis] Swift 5 GM; Fix Linux compile
2019-04-07 17:10:58 -04:00
Max Howell
7600e18972
[travis] Swift 5 GM; Fix Linux compile 2019-04-07 17:10:56 -04:00
Doug Stein
f1885f3d4f
'Cancel' for PromiseKit: add cancellable variants for #1024, plus doc update
* Add cancellable variants and cancellable dispatcher stubs for all new methods introduced by #1024
* Update Troubleshooting doc with solution for compilation timeouts, encountered primarily with cancellable promises
2019-04-07 17:10:40 -04:00
Nathan Hosselton
4692135d97
Update for v7 and regenerate Core/XCTestManifests
- remove `flags:` function params
- DispatchQueue? -> Dispatcher for `on:` params
- conf.Q -> conf.D for default `on:` values
- update Result case usage to `success` `failure`
- on.async(flags:) -> on.dispatch
2019-04-07 16:26:09 -04:00
Nathan Hosselton
78818516c5
Rename catchOnly -> catch, recoverOnly -> recover 2019-04-07 16:26:09 -04:00
Nathan Hosselton
4a8c2487d9
Forgot to pass () 2019-04-07 16:26:09 -04:00
Nathan Hosselton
a09eb08b32
Remove examples from docs on void recoverOnly 2019-04-07 16:26:08 -04:00
Nathan Hosselton
9e4b9be0d5
Provide Promise<Void>.recoverOnly variants 2019-04-07 16:26:08 -04:00
Nathan Hosselton
b286d7bd36
Documentation tweaks and test simplification 2019-04-07 16:26:08 -04:00
Nathan Hosselton
d91425dec3
Provide recoverOnly for specific error recovery 2019-04-07 16:26:07 -04:00
Nathan Hosselton
dd83de89fc
Rename generic parameter Error to E 2019-04-07 16:26:07 -04:00
Nathan Hosselton
eddafa8e8e
Allow specifying a CatchPolicy in catchOnly(Type)
Because for this error type accepting variant of
catchOnly it makes sense to want to not catch
specific cancellable cases in the type.
2019-04-07 16:26:07 -04:00
Nathan Hosselton
bd0a551392
Remove error param from catchOnly(object) handler
Rationale: Since this variant takes a specific
error object, it does not need checked against in
handler and is therefore likely to be explicitly
ignored (`_ in`). Thus removing the object removes
the need for this.
2019-04-07 16:26:07 -04:00
Nathan Hosselton
1495d68f77
Obfuscate catchOnly's promise behind a finalizer 2019-04-07 16:26:06 -04:00
Nathan Hosselton
b06d7e59ed
Provide catchOnly(…) for specific error handling 2019-04-07 16:26:06 -04:00
Doug Stein
087f066492
'Cancel' for PromiseKit: fix for #1026, plus cleanup
* Fix "Typechecking timeout compiling tests in v7 #1026" by specifying the closure return type in DispatcherTests
* Remove unnecessary "#if swift" checks in the cancellable code and tests
2019-04-07 16:26:06 -04:00
Max Howell
34e31140dc
Merge pull request #1022 from GarthSnyder/dispatcher-cleanup
Dispatchers cleanup
2019-04-07 16:26:05 -04:00
Garth Snyder
4ff28fad6c
Moved dispatcher implementations to subdirectory 2019-04-07 16:26:05 -04:00
Garth Snyder
c68af9f021
Add wrappers for DispatchQueue compatibility to Dispatchers 2019-04-07 16:26:05 -04:00
Garth Snyder
ed6a108e56
Access control rationalization for dispatchers 2019-04-07 16:25:32 -04:00
Doug
2b90cb3d4e
'Cancel' for PromiseKit (#899)
This patch adds the concept of a `CancelContext` to PromiseKit allowing chains to handle cancellation properly for each independent promise after the cancel point.
2019-04-07 16:25:31 -04:00
Max Howell
ccccc0cf14
Merge pull request #1017 from GarthSnyder/v7-dispatcher-types
* Add StrictRateLimitedDispatcher

* Add ConcurrencyLimitedDispatcher

* StrictRateLimitedDispatcher now schedules only on execution

* Refactor rate limited dispatchers onto common base

* Limiter dispatchers complete and tested

* Add CoreDataDispatcher

* Grooming, doc comments, NSLock -> DispatchQueue

* Break Dispatcher implementation tests into separate classes to allow parallelism

* Move time measurement outside of serialization for rate limit test

* Update testing for Linux and slow Travis environments

* Build all v7 branches
2019-04-07 16:24:12 -04:00
Garth Snyder
ddb9677a2f
Grooming, doc comments, NSLock -> DispatchQueue 2019-04-07 16:15:27 -04:00
Garth Snyder
ff06e0d1e7
Add CoreDataDispatcher 2019-04-07 16:15:27 -04:00
Garth Snyder
99b4804128
Limiter dispatchers complete and tested 2019-04-07 16:15:26 -04:00
Garth Snyder
6d2ea9cfe6
Refactor rate limited dispatchers onto common base 2019-04-07 16:15:26 -04:00
Garth Snyder
2a549fa7af
StrictRateLimitedDispatcher now schedules only on execution 2019-04-07 16:15:26 -04:00
Garth Snyder
87e84e6fe3
Add ConcurrencyLimitedDispatcher 2019-04-07 16:15:26 -04:00
Garth Snyder
c202ed68cc
Add StrictRateLimitedDispatcher 2019-04-07 16:15:25 -04:00
Garth Snyder
a90ce6b5e8
Final cleanup for Dispatcher conversion (#1016)
* Additional comments for Dispatcher.swift
* Remove .promise namespacer from Dispatcher.dispatch -> Guarantee/Promise
* Convert to LogEvent system, groom logging and tests
* Expand DispatchQueueDispatcher to hold both a DispatchGroup and a QoS
* Finalize dispatcher.dispatch and related tests
* Clean up DispatchQueue wrapping, avoid assuming any particular defaults
* CurrentThreadDispatcher.dispatch needn't mark closure arg as @escaping
* Test that DispatchQueue.pmkDefault is identifiable with ===
* Documentation updates
* Build any v7* branch
* Rebuild Linux test manifest, check return types of Dispatcher.dispatch {}
2019-04-07 16:15:21 -04:00
Max Howell
7d61133ebb
Use Swift 5’s Result 2019-04-07 16:13:03 -04:00
Garth Snyder
277944ff19
Generalize handler dispatch mechanisms 2019-04-07 16:12:38 -04:00
Max Howell
a484e750e4
v7 initial changes
* Swift 5 only
* No ObjC
* No deprecations
* No submodules
* Uses SwiftPM to generate an `.xcodeproj`
2019-04-07 16:12:27 -04:00
Max Howell
74402dcaae Fix for Swift 5 in 4.2 mode on Linux 2019-04-07 12:56:40 -04:00
Max Howell
60215282b6
[travis] Swift 5 GM; Fixes Linux build 2019-03-25 21:37:03 -04:00
Max Howell
69b112b28e
Deprecate promisekit.org
[ci skip]
2019-02-11 19:44:11 -05:00