1
0
mirror of https://github.com/danog/amp.git synced 2024-12-02 17:37:50 +01:00
Commit Graph

326 Commits

Author SHA1 Message Date
Aaron Piotrowski
80ecfe6b99
Promisify signals 2020-10-10 09:06:49 -05:00
Aaron Piotrowski
ee3c09087b
Merge branch 'master' into v3 2020-10-10 08:57:34 -05:00
Aaron Piotrowski
eb2f325586
Fix NativeDriver when only signals are enabled 2020-10-10 08:54:50 -05:00
Aaron Piotrowski
cecbbd3f40
Drop sleep() and refactor delay to use await() 2020-10-06 23:40:14 -05:00
Aaron Piotrowski
1b30909215
Remove succeed() and fail() 2020-10-04 10:22:51 -05:00
Aaron Piotrowski
40aab8eef5
Add defer() 2020-10-04 10:22:21 -05:00
Aaron Piotrowski
3dbebd2a77
Remove unused BaseTest 2020-10-04 10:12:22 -05:00
Aaron Piotrowski
b226030a11
Remove tests incompatible with ext-fiber 2020-10-03 21:57:35 -05:00
Aaron Piotrowski
249aa95256
Forbid loop nesting 2020-10-03 09:42:29 -05:00
Aaron Piotrowski
45bd189e76
Add Driver::clear()
Intended for tests over swapping the entire event loop.

This allows forbidding swapping the global event loop once it is started.
2020-10-03 08:38:31 -05:00
Aaron Piotrowski
822995a69b
Remove InvalidYieldError
Unused.
2020-10-02 22:49:41 -05:00
Aaron Piotrowski
825efaf841
Fix test 2020-10-02 22:42:52 -05:00
Aaron Piotrowski
4c8cd6b7b1
Revert DriverControl
Simplifies fiber running the loop. Control complexity seems unnecessary now since the loop should not need to be started by the user.
2020-10-02 22:26:10 -05:00
Aaron Piotrowski
27a8facd6a
Update tests for fibers 2020-10-02 13:40:29 -05:00
Aaron Piotrowski
7e03928faf
Drop CallableMaker 2020-09-26 22:31:08 -05:00
Aaron Piotrowski
07a9965ba6
Run promisor in LazyPromise in new fiber 2020-09-26 22:26:57 -05:00
Aaron Piotrowski
9f68bd4046
Remove Driver::run() and stop()
Added Driver::isRunning().

Driver now must be started and stopped through an instance of DriverControl.
2020-09-26 12:50:30 -05:00
Aaron Piotrowski
9a2ebe777a
Merge branch 'kelunik-nested-wait' into v3 2020-09-26 11:40:38 -05:00
Aaron Piotrowski
6dd2b990f8
Revert AsyncGenerator being lazy 2020-09-24 12:53:32 -05:00
Aaron Piotrowski
9a13937fef
Make explicit disposal fail pending promises
Destruction of the pipeline does not fail pending promises, but calling dispose() now will.
2020-09-24 12:53:31 -05:00
Aaron Piotrowski
657614c036
Dispose after all pending promises are fulfilled
Allows continue() to be called, then dispose(), but the pipeline is not actually disposed until those pending promises are fulfilled.
2020-09-24 12:53:31 -05:00
Aaron Piotrowski
5e521daa16
Rename to Pipeline 2020-09-24 12:53:31 -05:00
Aaron Piotrowski
52d50a5b6d
Revert adding onDisposal() and onCompletion()
This largely reverts 6ab9048e717bb1f69f418d82e697a968721115c0.
2020-09-24 12:53:31 -05:00
Aaron Piotrowski
dd0f01f4db
Add onDisposal() and onCompletion() to Stream
onCompletion callbacks are invoked if complete() or fail() is called before the stream is disposed.

onDisposal callbacks are invoked if the stream is disposed before being completed or failed.

Forbid failing a stream with DisposedException.
2020-09-24 12:53:31 -05:00
Aaron Piotrowski
42d8ce764b
Add StreamSource::onDisposal() 2020-09-24 12:53:31 -05:00
Aaron Piotrowski
217c31c5ce
Add Promise\succeed() and Promise\fail() 2020-09-24 12:53:31 -05:00
Aaron Piotrowski
ee76c97c51
Add StreamSource::isDisposed() 2020-09-24 12:53:30 -05:00
Aaron Piotrowski
0ddf9a656e
Add Deferred::isResolved() and StreamSource::isComplete() 2020-09-24 12:53:30 -05:00
Aaron Piotrowski
1577906fc1
Make AsyncGenerator execution lazy
Matches behavior of Generator which does not start execution until an iteration method is invoked.
2020-09-24 12:53:30 -05:00
Aaron Piotrowski
b64b3affc9
Rename yield() to emit() 2020-09-24 12:53:30 -05:00
Aaron Piotrowski
66f0deb563
Drop YieldedValue 2020-09-24 12:53:29 -05:00
Aaron Piotrowski
8df006b011
Remove unnecessary internal interface
Switched Yielder trait to a concrete class YieldSource.
2020-09-24 12:53:29 -05:00
Aaron Piotrowski
d496c9db24
Resolve promise with YieldedValue
A suggested alternative to resolving with [$yieldedValue] since static analysis (specifically Psalm) doesn't play well with that API.

Will revert if Psalm changes or we decide to resolve with [$yieldedValue] anyway.
2020-09-24 12:53:29 -05:00
Aaron Piotrowski
57924690fe
Remove key 2020-09-24 12:53:29 -05:00
Niklas Keller
85b4707832
Use AsyncTestCase for stream tests 2020-09-24 12:53:28 -05:00
Aaron Piotrowski
6283d9bbb7
Intial stream transformations 2020-09-24 12:53:28 -05:00
Aaron Piotrowski
12c97b2561
Add explicit dispose() method to Stream 2020-09-24 12:53:28 -05:00
Aaron Piotrowski
96007f11aa
Add Streams 2020-09-24 12:53:27 -05:00
Niklas Keller
05483cdbef
Enforce timer interval as minimum time to execution (#319)
Co-authored-by: Aaron Piotrowski <aaron@trowski.com>
2020-07-14 21:45:35 +02:00
Niklas Keller
e2c63c83eb
Add Amp\Iterator\discard (#315) 2020-05-06 18:57:29 +02:00
Niklas Keller
1e58d53e4a Fix code style and run PsalmTest only on PHP 7.1+ 2020-04-30 06:54:50 +02:00
Niklas Keller
17e2c2344c Improve call / coroutine / wait types, add psalm test 2020-04-30 06:46:52 +02:00
Niklas Keller
5b4d019753 Allow tested calls to Amp\Promise\wait 2020-04-15 22:47:43 +02:00
Niklas Keller
feca077369
Provide useful exception trace in TimeoutCancellationToken (#303)
Without this, the exception trace is pretty useless, because it only includes Loop::run() and other internal loop calls, giving absolutely no indication which kind of thing had a timeout.

Use debug_backtrace instead of creating the exception early, because it helps with the changes to GC behavior such a change might introduce.

Co-authored-by: Aaron Piotrowski <aaron@trowski.com>
2020-04-04 17:05:26 +02:00
Niklas Keller
5a294f1381 Fix TracingDriver, add TracingDriverTest 2019-10-01 21:39:23 +02:00
Niklas Keller
4d849191e5
Fix build on Travis (#281) 2019-09-21 23:17:45 +02:00
Aaron Piotrowski
a726db92a5 Only create deferred for backpressure if necessary 2019-09-21 18:30:14 +02:00
Niklas Keller
558f1e9876 Catch also \Exception in clearLoopRethrows() 2019-05-31 11:38:02 -05:00
Niklas Keller
214443b8c6 Fix code style 2019-05-31 11:38:02 -05:00
Niklas Keller
c12828081f Fix exceptions bubbling from Coroutine::__destruct
This has been an edge case potentially hiding some exceptions. The tests have been refactored to error if the loop has watchers leaking from one test to another test.
2019-05-31 11:38:02 -05:00