Commit 2e963430 authored by 王源's avatar 王源 🎧

异常日志排除Cannot select any node from load balancer错误

parent 6ec80c96
...@@ -18,6 +18,9 @@ class ExceptionLogProducer extends ProducerMessage ...@@ -18,6 +18,9 @@ class ExceptionLogProducer extends ProducerMessage
public function __construct($data) public function __construct($data)
{ {
if (strpos($data['message'], 'Cannot select any node from load balancer') !== false) {
return;
}
try { try {
$data['operator'] = Auth::user()['name']; $data['operator'] = Auth::user()['name'];
} catch (HttpResponseException $e) { } catch (HttpResponseException $e) {
...@@ -29,10 +32,10 @@ class ExceptionLogProducer extends ProducerMessage ...@@ -29,10 +32,10 @@ class ExceptionLogProducer extends ProducerMessage
try { try {
put_log("git: git blame -L {$data['line']},{$data['line']} {$data['file']}", 'ExceptionLogProducerEcho.log'); put_log("git: git blame -L {$data['line']},{$data['line']} {$data['file']}", 'ExceptionLogProducerEcho.log');
exec("git blame -L {$data['line']},{$data['line']} {$data['file']}", $output); exec("git blame -L {$data['line']},{$data['line']} {$data['file']}", $output);
put_log("output: $output", 'ExceptionLogProducerEcho.log'); put_log("output: {$output[0]}", 'ExceptionLogProducerEcho.log');
if (!empty($output[0]) && is_string($output[0])) { if (!empty($output[0]) && is_string($output[0])) {
preg_match('/(?<=\()[^ ]+/', $output[0], $matches); preg_match('/(?<=\()[^ ]+/', $output[0], $matches);
put_log("matches: $matches", 'ExceptionLogProducerEcho.log'); put_log("matches: {$matches[0]}", 'ExceptionLogProducerEcho.log');
if (!empty($matches[0])) { if (!empty($matches[0])) {
$data['coder'] = $matches[0]; $data['coder'] = $matches[0];
} }
......
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