Parse updates
This commit is contained in:
parent
b59e62a725
commit
c71dd59f87
@ -141,7 +141,6 @@ If your code still relies on the **old synchronous behaviour**, __don't worry__,
|
|||||||
However, old synchronous behaviour is deprecated, and I **highly recommend** you switch to async, due to the **huge performance** and **parallelism benefits**.
|
However, old synchronous behaviour is deprecated, and I **highly recommend** you switch to async, due to the **huge performance** and **parallelism benefits**.
|
||||||
|
|
||||||
***
|
***
|
||||||
|
|
||||||
To implement async, I wrote loads of new async APIs in MadelineProto, as you may have seen above.
|
To implement async, I wrote loads of new async APIs in MadelineProto, as you may have seen above.
|
||||||
I used the **awesome** [amphp](https://amphp.org) async framework as base, on which to build the new MadelineProto APIs.
|
I used the **awesome** [amphp](https://amphp.org) async framework as base, on which to build the new MadelineProto APIs.
|
||||||
I heavily modified amphp coroutines and wrapped [all of the AMPHP event loop methods](https://docs.madelineproto.xyz/docs/ASYNC.html#madelineproto-and-amphp-async-apis) to add native support for yielding generators.
|
I heavily modified amphp coroutines and wrapped [all of the AMPHP event loop methods](https://docs.madelineproto.xyz/docs/ASYNC.html#madelineproto-and-amphp-async-apis) to add native support for yielding generators.
|
||||||
@ -393,4 +392,7 @@ In a few weeks I will set MadelineProto 4.0 **as default** with `madeline.php`:
|
|||||||
tell about restart
|
tell about restart
|
||||||
tell about madeline.php loading in the same dire
|
tell about madeline.php loading in the same dire
|
||||||
|
|
||||||
remind about using the define
|
remind about using the define
|
||||||
|
|
||||||
|
fix trimming newlines in beginning
|
||||||
|
weird splitting mmm ```
|
@ -75,11 +75,12 @@ class FeedLoop extends ResumableSignalLoop
|
|||||||
yield $this->parse($updates);
|
yield $this->parse($updates);
|
||||||
$updates = null;
|
$updates = null;
|
||||||
}
|
}
|
||||||
if ($this->parsedUpdates) {
|
while ($this->parsedUpdates) {
|
||||||
foreach ($this->parsedUpdates as $update) {
|
$parsedUpdates = $this->parsedUpdates;
|
||||||
|
$this->parsedUpdates = [];
|
||||||
|
foreach ($parsedUpdates as $update) {
|
||||||
yield $API->save_update_async($update);
|
yield $API->save_update_async($update);
|
||||||
}
|
}
|
||||||
$this->parsedUpdates = [];
|
|
||||||
$this->API->signalUpdate();
|
$this->API->signalUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user