Commit 32129f51 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

added liveness and readiness for fetcher

parent eb379abf
......@@ -50,10 +50,17 @@ class RequestFetcher extends Command
*/
public function handle()
{
$pidFile = "/tmp/fetcher";
pcntl_signal(SIGINT, [$this, "sig_handler"]);
pcntl_signal(SIGTERM, [$this, "sig_handler"]);
pcntl_signal(SIGHUP, [$this, "sig_handler"]);
touch($pidFile);
if (!file_exists($pidFile)) {
return;
}
try {
$blocking = false;
$redis = Redis::connection("cache");
......@@ -108,9 +115,8 @@ class RequestFetcher extends Command
usleep(50 * 1000);
}
}
} catch (\Exception $e) {
Log::error($e->getMessage());
} finally {
unlink($pidFile);
curl_multi_close($this->multicurl);
}
}
......
......@@ -141,4 +141,18 @@ spec:
command: ["su"]
args: ["-s", "/bin/sh", "-c", "php artisan requests:fetcher", "nginx"]
imagePullPolicy: {{ .Values.image.pullPolicy }}
livenessProbe:
exec:
command:
- cat
- /tmp/fetcher
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
readinessProbe:
exec:
command:
- cat
- /tmp/fetcher
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
{{- end -}}
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