diff options
Diffstat (limited to 'src/engine/VyOSElasticModernFulltextStorageEngine.php')
| -rw-r--r-- | src/engine/VyOSElasticModernFulltextStorageEngine.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/engine/VyOSElasticModernFulltextStorageEngine.php b/src/engine/VyOSElasticModernFulltextStorageEngine.php index 211a196..e036082 100644 --- a/src/engine/VyOSElasticModernFulltextStorageEngine.php +++ b/src/engine/VyOSElasticModernFulltextStorageEngine.php @@ -261,16 +261,18 @@ abstract class VyOSElasticModernFulltextStorageEngine throw $ex; } + // HTTP request succeeded — mark the host as healthy regardless of whether + // the response body is valid JSON. JSON parse failure is an application + // error, not a host-connectivity failure. + $host->didHealthCheck(true); + if ($method !== 'GET') { return null; } try { - $decoded = phutil_json_decode($body); - $host->didHealthCheck(true); - return $decoded; + return phutil_json_decode($body); } catch (PhutilJSONParserException $ex) { - $host->didHealthCheck(false); throw new Exception( pht('Elasticsearch server returned invalid JSON.'), 0, |
