From 7ce856e9c42d735666dbca5abb9b1d7f2f544414 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Fri, 21 Jun 2024 19:32:16 +0200 Subject: [PATCH] Remove redundant bulking --- src/Controllers/ApiController.php | 33 +------------------------------ 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/src/Controllers/ApiController.php b/src/Controllers/ApiController.php index 8bd7969..61814b8 100644 --- a/src/Controllers/ApiController.php +++ b/src/Controllers/ApiController.php @@ -44,37 +44,6 @@ class ApiController extends AbstractApiController return $this->callApiCommon($madelineProto); } - //GROUP REQUESTS IN BULKS - static $futures = []; - - $futures[] = $future = async($this->callApiCommon(...), $madelineProto); - delay($this->waitNextTick()); - - if ($futures) { - awaitAll($futures); - Logger::getInstance()->notice("Executed bulk requests:" . count($futures)); - $futures = []; - } - - return $future->await(); + return $this->callApiCommon($madelineProto); } - - /** - * Sync threads execution via time ticks - * Need to enable madelineProto futures bulk execution - * @param float $tick interval of execution in seconds. - */ - protected function waitNextTick(float $tick = 0.5): float { - $tickMs = $tick * 1000; - $now = (int)(microtime(true) * 1000); - $currentTick = intdiv((int)(microtime(true) * 1000), $tickMs); - $nextTick = ($currentTick + 1); - $nextTickTime = $nextTick * $tickMs; - $wait = round(($nextTickTime - $now)/1000, 3); - - Logger::getInstance()->notice("Waiting $wait seconds before tick"); - - return $wait; - } - } \ No newline at end of file