Commit 771fcd7c authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

added delay for checking liveness of redis container

parent 3b53aa3d
...@@ -50,11 +50,26 @@ class RequestFetcher extends Command ...@@ -50,11 +50,26 @@ class RequestFetcher extends Command
*/ */
public function handle() public function handle()
{ {
$pidFile = "/tmp/fetcher"; $pidFile = "/tmp/fetcher";
pcntl_signal(SIGINT, [$this, "sig_handler"]); pcntl_signal(SIGINT, [$this, "sig_handler"]);
pcntl_signal(SIGTERM, [$this, "sig_handler"]); pcntl_signal(SIGTERM, [$this, "sig_handler"]);
pcntl_signal(SIGHUP, [$this, "sig_handler"]); pcntl_signal(SIGHUP, [$this, "sig_handler"]);
// Redis might not be available now
for ($count = 0; $count < 10; $count++) {
try {
Redis::connection();
break;
} catch (\Predis\Connection\ConnectionException $e) {
if ($count >= 9) {
// If its not available after 10 seconds we will exit
return;
}
sleep(1);
}
}
touch($pidFile); touch($pidFile);
if (!file_exists($pidFile)) { if (!file_exists($pidFile)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment