Aaron Piotrowski
eaa7c45049
Make Driver an interface
2020-11-01 09:43:21 -06:00
Aaron Piotrowski
6cf7ae13bb
Remove automatic Generator to Coroutine conversion
2020-10-30 10:36:19 -05:00
Aaron Piotrowski
7612ef3f1e
Drop direct conversion of React promises
...
React promises are still supported using Amp\Promise\adapt().
2020-10-30 10:19:12 -05:00
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
Niklas Keller
aeb5de16d9
Add failing Coroutine test
2019-05-31 11:38:02 -05:00
Aaron Piotrowski
ef83723a79
Fix signal handler in NativeDriver when used with pcntl_async_signals
...
Fixes #264 .
2019-02-25 18:05:47 -06:00
Bob Weinand
7075ef7d74
Fix #251 - 100% CPU usage in NativeDriver
...
Also use better bounds for timer - it must not execute before, but may execute a little later (on my system it were up to 7 ms actually)
2018-12-11 11:31:37 +01:00
Aaron Piotrowski
77a12c823b
Add Loop::now()
2018-11-26 21:59:15 +01:00
Sascha-Oliver Prolic
96c2eeaa1f
Add Promise\wrap ( #234 )
2018-11-26 19:36:46 +01:00
Sascha-Oliver Prolic
4a98cc4fde
Add timeoutWithDefault function ( #245 )
2018-11-25 17:56:42 +01:00
Niklas Keller
b73e03bfe2
Rename Iterator\collect to Iterator\toArray
2018-11-25 17:09:50 +01:00
Niklas Keller
a60a8e1906
Add tests for Iterator\collect
2018-11-25 17:09:50 +01:00
Gabriel Caruso
6be5d4bfc5
Use dedicated PHPUnit assertions
2018-11-14 22:14:22 +01:00
Niklas Keller
fa3fe1d20b
Apply PSR-2
2018-06-18 20:00:01 +02:00
Aaron Piotrowski
242d78a6ec
Fix 212 and ignore unreference on invalid watchers ( #216 )
...
Fix #212 & Ignore unreference on invalid watchers
2018-04-12 09:46:52 +02:00
Niklas Keller
98cfaa63ca
Remove unused variables
2017-12-05 08:48:56 +01:00
Markus Staab
34bf671f13
Automatically add \ for buitins ( #186 )
...
Fixes #185 .
2017-11-29 13:36:50 +01:00
Niklas Keller
bd428ca31b
Fix DriverTest::testBug163ConsecutiveDelayed to use assigned driver
2017-09-19 19:58:07 +02:00
Niklas Keller
7a04dc5c21
Fix EventDriver warnings and bugs
...
Fixes #163 , #159 .
2017-09-17 12:18:04 +02:00
Niklas Keller
36794da8e9
Fix code style
2017-07-09 14:17:47 +02:00
Bob Weinand
5e93318d85
Fix issue with the loop not terminating with only unreferenced watchers
2017-07-09 09:28:32 +02:00
Aaron Piotrowski
5f3e21a4a4
Add TimeoutCancellationToken
2017-06-13 12:41:47 -05:00
Niklas Keller
38ef4d9ffa
Fix issues with interval = 0 repeat watchers, fixes #131
2017-05-23 19:46:23 +02:00
Niklas Keller
dbc853c3f1
Fix timers with interval = 0 in NativeDriver
2017-05-22 19:54:14 +02:00
Niklas Keller
e8e26d79e7
Revert "Drop max continuation depth"
...
This reverts commit cdf28fa938
.
As streams always buffer before applying backpressure, these might
result in a stack overflow. Another example is file streaming with
the blocking driver, which always immediately succeeds.
2017-05-20 09:40:56 +02:00
Niklas Keller
a289e7e41d
Increase testNestedLoopSignalDispatch timeouts
2017-05-19 16:47:55 +02:00
Niklas Keller
03d1630b69
Add further tests for cancellation
2017-05-16 21:56:52 +02:00
Niklas Keller
fdf18dedd7
Fix tabs → spaces
2017-05-16 20:08:27 +02:00
Aaron Piotrowski
be2a9f8c07
Merge pull request #130 from amphp/cancellation
...
Implement cancellation primitives, resolves #125
2017-05-16 11:32:42 -05:00
Bob Weinand
6e52f3e211
Fix potential issues when operating on destroyed uv handles in shutdown sequence
2017-05-16 18:17:12 +02:00
Niklas Keller
61a7596106
Implement cancellation primitives, resolves #125
2017-05-14 23:07:49 +02:00
Bob Weinand
f063a8311a
Shutup "style" checker....
2017-05-07 19:14:13 +02:00
Bob Weinand
6c03950abd
Do not run uv tests separately in its own process
2017-05-07 19:02:22 +02:00
Bob Weinand
55de30c53d
Properly run gc_collect_cycles() between tests
...
This avoids leaking file descriptors with Uv
2017-05-07 13:09:59 +02:00
Niklas Keller
5c81015ddb
Increase repeat watcher to make test failure more unlikely
2017-05-03 22:21:57 +02:00
Niklas Keller
50b37b23ef
Add asyncCall
2017-05-03 15:21:49 +02:00
Niklas Keller
def42c496a
Fix code style
2017-05-02 22:09:11 +02:00
Niklas Keller
5471b17a67
Fix broken test
2017-05-02 21:57:00 +02:00
Niklas Keller
8d9219bf92
Increase timer delay and defer in testMultipleWatchersOnSameDescriptor
2017-05-02 21:51:52 +02:00
Niklas Keller
e00ab0db75
Wrap execution order test in extra defer
...
This should mitigate the EventDriverTest occassionally failing.
In case this doesn't help, increase the rep1 repeat timer interval.
2017-05-02 21:42:45 +02:00
Niklas Keller
ad08ffba1d
✅ Add missing test case in ProducerTraitTest
2017-05-02 19:13:53 +02:00
Niklas Keller
1419bd6c0c
Remove unused imports
2017-05-02 19:04:25 +02:00
Niklas Keller
783fe8c4f4
✅ Add asyncCoroutine and ReactPromise tests
2017-05-02 18:59:52 +02:00
Niklas Keller
141875b133
🔥 Kill pipe and capture
...
Use Amp\call instead.
2017-05-02 18:32:59 +02:00
Niklas Keller
14cea0cbf0
✅ Added further Internal\Producer tests
2017-05-02 18:10:10 +02:00
Niklas Keller
b5770ba64a
Rename missed Pause to Delayed
2017-05-02 07:22:53 +02:00
Aaron Piotrowski
835e617054
More stream → iterator
...
Hopefully that's all of them…
2017-05-02 07:07:43 +02:00
Aaron Piotrowski
da9b724f5b
getIterator → iterate
2017-05-02 07:07:43 +02:00
Aaron Piotrowski
91c8da9fec
Replace more occurrences of stream
2017-05-02 07:07:43 +02:00
Aaron Piotrowski
8ccb0643c1
Fail tests if exception is not thrown from advance()
2017-05-02 07:07:43 +02:00
Aaron Piotrowski
9a2a4966c6
Fix code style issues
2017-05-02 07:07:20 +02:00