I created a page at http://localhost/xxx.php which has just just this code sleep(1000000000) which means it will hang almost forever.
Then I used the code below to request this page above with a timeout of 1000ms (just like your documentation tells me to do). The problem: when I run the code below it shows that the script waited almost 6000ms for the timeout instead of 1000ms. I know that the time it takes to make the request itself is also computed, however since it's localhost, this time is very very small.
I need the timeout to be honored. Am I doing something wrong? Thanks a lot!
<?php
require "vendor/autoload.php";
use HeadlessChromium\BrowserFactory;
use HeadlessChromium\Page;
use HeadlessChromium\Exception\OperationTimedOut;
use HeadlessChromium\Exception\NavigationExpired;
$browserFactory = new BrowserFactory();
$browser = $browserFactory->createBrowser();
try{
$page = $browser->createPage();
$time = time();
try{
$page->navigate("http://localhost/xxx.php")->waitForNavigation(Page::LOAD,1000);
}
catch (OperationTimedOut $e){}
catch (NavigationExpired $e){}
echo '<div>Interval: ' . (time() - $time) . '</div>';
}
finally{
$browser->close();
}
?>
The weird thing is that if I use timeout as 10 then it timeouts almost immediatly (as expected) however if I use 30 it will also wait for 6000ms. Any value above 30 will timeout after 6000ms.
This issue has been automatically marked as stale because there has been no recent activity. It will be closed after 30 days if no further activity occurs. Thank you for your contributions.
Hi,
I created a page at
http://localhost/xxx.php
which has just just this codesleep(1000000000)
which means it will hang almost forever.Then I used the code below to request this page above with a timeout of 1000ms (just like your documentation tells me to do). The problem: when I run the code below it shows that the script waited almost 6000ms for the timeout instead of 1000ms. I know that the time it takes to make the request itself is also computed, however since it's localhost, this time is very very small.
I need the
timeout
to be honored. Am I doing something wrong? Thanks a lot!The weird thing is that if I use timeout as
10
then it timeouts almost immediatly (as expected) however if I use30
it will also wait for 6000ms. Any value above30
will timeout after 6000ms.