You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I have modified the example you have given on your site. I noticed that whatever value you have the timeout set for, no matter how many items you feed into the array, the scripts execution time will be as long as the timeout is set for plus whatever you have running before or after it. I believe this is because the timer being used is simply to prevent long running scripts that timeout. Nevertheless, if I have 1000 items in the queue and a timeout of 2 seconds, everything fails. 2 seconds is like a hard limit for the execution time of the script. If I put in 1 URL to a file, like a 1kb thumbnail and put the timeout at 30, the execution time will be just over 30 seconds. I believe the function below is where the problem needs addressing. Either the timer needs to be canceled or the promise needs to be rejected or accepted? I am not sure what is the best practice as I am still new to reactPHP.
Keep up the great work, your site by far is the best on the web and your videos are top notch!
` public function parse(array $urls = [], $timeout = 10, $concurrencyLimit = 8)
{
$queue = $this->initQueue($concurrencyLimit);
foreach ($urls as $url) {
$promise = $queue($url)->then(
function (\Psr\Http\Message\ResponseInterface $response) {
if ($response->getStatusCode() == 200) {
$this->parsed[] = $response->getStatusCode();
// TODO Cancel timer or fulfill / reject promise???
}
},
function (Exception $exception) use ($url) {
$this->errors[$url] = $exception->getMessage();
}
);
$this->loop->addTimer($timeout, function () use ($promise) {
$promise->cancel();
});
}
}
`
The text was updated successfully, but these errors were encountered:
Dustin013
changed the title
Parser script timeout makes the speed per record whatever the value is set to.
Parser script timeout makes the speed per run last as long as the timeout value.
Jul 13, 2018
So I have modified the example you have given on your site. I noticed that whatever value you have the timeout set for, no matter how many items you feed into the array, the scripts execution time will be as long as the timeout is set for plus whatever you have running before or after it. I believe this is because the timer being used is simply to prevent long running scripts that timeout. Nevertheless, if I have 1000 items in the queue and a timeout of 2 seconds, everything fails. 2 seconds is like a hard limit for the execution time of the script. If I put in 1 URL to a file, like a 1kb thumbnail and put the timeout at 30, the execution time will be just over 30 seconds. I believe the function below is where the problem needs addressing. Either the timer needs to be canceled or the promise needs to be rejected or accepted? I am not sure what is the best practice as I am still new to reactPHP.
Keep up the great work, your site by far is the best on the web and your videos are top notch!
`
public function parse(array $urls = [], $timeout = 10, $concurrencyLimit = 8)
`
The text was updated successfully, but these errors were encountered: