1
0
Fork 0
mirror of synced 2024-07-01 20:50:49 +12:00

Merge branch 'appwrite:master' into feat-1764-telugu-translation

This commit is contained in:
LN 2021-11-08 17:35:51 +05:30 committed by GitHub
commit 4927053fb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,9 +46,20 @@ App::get('/v1/health/db')
->action(function ($response, $utopia) { ->action(function ($response, $utopia) {
/** @var Appwrite\Utopia\Response $response */ /** @var Appwrite\Utopia\Response $response */
/** @var Utopia\App $utopia */ /** @var Utopia\App $utopia */
$utopia->getResource('db'); try {
$db = $utopia->getResource('db'); /* @var $db PDO */
$response->json(['status' => 'OK']); // Run a small test to check the connection
$statement = $db->prepare("SELECT 1;");
$statement->closeCursor();
$statement->execute();
} catch (Exception $_e) {
throw new Exception('Database is not available', 500);
}
return $response->json(['status' => 'OK']);
}); });
App::get('/v1/health/cache') App::get('/v1/health/cache')
@ -64,9 +75,14 @@ App::get('/v1/health/cache')
->action(function ($response, $utopia) { ->action(function ($response, $utopia) {
/** @var Appwrite\Utopia\Response $response */ /** @var Appwrite\Utopia\Response $response */
/** @var Utopia\App $utopia */ /** @var Utopia\App $utopia */
$utopia->getResource('cache'); /** @var Redis */
$redis = $utopia->getResource('cache');
$response->json(['status' => 'OK']); if ($redis->ping(true)) {
return $response->json(['status' => 'OK']);
} else {
throw new Exception('Cache is not available', 500);
}
}); });
App::get('/v1/health/time') App::get('/v1/health/time')