From 3ff79cb0beecd4deec4b3e26d5ecc189645b1146 Mon Sep 17 00:00:00 2001 From: yggverse Date: Wed, 17 Jul 2024 11:04:16 +0300 Subject: [PATCH] draft async request for sync gemini/next api --- src/Model/Connection.php | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/src/Model/Connection.php b/src/Model/Connection.php index 7a3b9c67..c4cadaed 100644 --- a/src/Model/Connection.php +++ b/src/Model/Connection.php @@ -33,21 +33,35 @@ class Connection extends \Yggverse\Yoda\Abstract\Model\Connection break; - case 'gemini': + case 'gemini': // async - (new Gemini($this))->request( - $address, - $timeout - ); + $pid = pcntl_fork(); + + if ($pid === 0) + { + (new Gemini($this))->request( + $address, + $timeout + ); + + exit; + } break; - case 'nex': + case 'nex': // async - (new Nex($this))->request( - $address, - $timeout - ); + $pid = pcntl_fork(); + + if ($pid === 0) + { + (new Nex($this))->request( + $address, + $timeout + ); + + exit; + } break;