fb2eaa3950
* WIP(delete): remove business logic from controller
* fix(deletion): handle group leave logic on app server still
* fix(lint): unused import
* fix(import): bracket syntax
* fix(test): adapt test for worker flow
* fix(deletion): update delete/feedback form copy
* fix(text): don't break to new paragraph about Gems
* fix(deletion): remove orphaned chat messages
* Revert "fix(deletion): handle group leave logic on app server still"
This reverts commit 9db541f4c3.
* fix(tests): remove tests
These can potentially be tested in the worker's suite? They target functionality that the group leave route handles within the deletion flow
* fix(lint): no-undef
* refactor redis setup into own file and use ioredis
* use bullmq directly to schedule jobs
* add space
* add key prefix
* add semicolon
* fix(jobs): update redis package
---------
Co-authored-by: Phillip Thelen <phillip@habitica.com>
43 lines
966 B
JavaScript
43 lines
966 B
JavaScript
import {
|
|
disableCache,
|
|
} from '../../middlewares/cache';
|
|
import SERVER_STATUS from '../../libs/serverStatus';
|
|
|
|
const api = {};
|
|
|
|
/**
|
|
* @api {get} /api/v3/ready Get Habitica's Server readiness status
|
|
* @apiName GetReady
|
|
* @apiGroup Status
|
|
*
|
|
* @apiSuccess {String} data.status 'ready' if everything is ok
|
|
*
|
|
* @apiSuccessExample {JSON} Server is Ready
|
|
* {
|
|
* 'status': 'ready',
|
|
* }
|
|
*/
|
|
api.getReady = {
|
|
method: 'GET',
|
|
url: '/ready',
|
|
// explicitly disable caching so that the server is always checked
|
|
middlewares: [disableCache],
|
|
async handler (req, res) {
|
|
// This allows kubernetes to determine if the server is ready to receive traffic
|
|
if (!SERVER_STATUS.MONGODB
|
|
|| !SERVER_STATUS.RATE_LIMITER
|
|
|| !SERVER_STATUS.WORKER
|
|
|| !SERVER_STATUS.EXPRESS) {
|
|
res.respond(503, {
|
|
status: 'not ready',
|
|
});
|
|
} else {
|
|
res.respond(200, {
|
|
status: 'ready',
|
|
});
|
|
}
|
|
},
|
|
};
|
|
|
|
export default api;
|