From 5d0c81ba35f16dc01dff3b0e6d211a9bdd40f345 Mon Sep 17 00:00:00 2001 From: VennV <111500380+VennDev@users.noreply.github.com> Date: Thu, 29 Aug 2024 02:06:38 +0700 Subject: [PATCH] Update README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index cb203d7f..c28db5df 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,15 @@ As you can see that I stopped at that very moment to do a wait for a task to com The Await-Generator has a problem that if I create a promise and just ask it to run without waiting immediately after I declare it, it's like if you have a for loop for billions of numbers, if I wait and run the promise right below it, it will tell me that I'm synchronizing? I've noticed that there is a queue in the library's Await processing class, however, assuming that if no promises are triggered, the promises that need to be fulfilled are when they are processed? and where is their real-time? What if I want the promise of processing 1 billion tasks and needing to do it immediately after completing it will fulfill some parameter to do the next thing? Note that this is 1 billion. +```php +$channel = new Channel; +Await::f2c(function() use ($channel) { + for ($i = 0; $i < 5000000; $i++) { + yield from $channel->sendAndWait($i); + } +}); +``` +The question arises that why do I have to?? wait a long time to handle a big disagreement like this without handling them asynchronously and quickly? - **Speed test:** [Code](https://gist.github.com/VennDev/4f7be83d55abfbbf44ff2d249e94968c) with according to the inherent method, Await-Generator still wants to wait and process as usual without using the Task-Scheduler. ![image](https://github.com/user-attachments/assets/07a39109-8db4-488d-a0db-6e3404edadf3)