Skip to content
Snippets Groups Projects

Resolve "use multi curl to improve performance"

Merged Ghost User requested to merge 19-use-multi-curl-to-improve-performance into master
Files
8
@@ -155,13 +155,8 @@ class RequestFetcher extends Command
Log::error($error);
}
if ($responseCode !== 200) {
Log::debug($resulthash);
Log::debug("Got responsecode " . $responseCode . " fetching \"" . curl_getinfo($info["handle"], CURLINFO_EFFECTIVE_URL) . "\n");
} else {
$body = \curl_multi_getcontent($info["handle"]);
}
$body = \curl_multi_getcontent($info["handle"]);
Redis::pipeline(function ($pipe) use ($resulthash, $body, $cacheDurationMinutes) {
$pipe->lpush($resulthash, $body);
$pipe->expire($resulthash, 60);
@@ -174,6 +169,8 @@ class RequestFetcher extends Command
Log::error($e->getMessage());
}
}
} catch (\Exception $e) {
Log::error($e->getMessage());
} finally {
\curl_multi_remove_handle($mc, $info["handle"]);
}
Loading