feat(backend): also check meilisearch status if available
This commit is contained in:
parent
6edcde9c4e
commit
bda337db4a
|
@ -5,6 +5,7 @@ import { bindThis } from '@/decorators.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { readyRef } from '@/boot/ready.js';
|
import { readyRef } from '@/boot/ready.js';
|
||||||
import type { FastifyInstance, FastifyPluginOptions } from 'fastify';
|
import type { FastifyInstance, FastifyPluginOptions } from 'fastify';
|
||||||
|
import type { MeiliSearch } from 'meilisearch';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class HealthServerService {
|
export class HealthServerService {
|
||||||
|
@ -23,6 +24,9 @@ export class HealthServerService {
|
||||||
|
|
||||||
@Inject(DI.db)
|
@Inject(DI.db)
|
||||||
private db: DataSource,
|
private db: DataSource,
|
||||||
|
|
||||||
|
@Inject(DI.meilisearch)
|
||||||
|
private meilisearch: MeiliSearch | null,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
|
@ -35,6 +39,7 @@ export class HealthServerService {
|
||||||
this.redisForSub.ping(),
|
this.redisForSub.ping(),
|
||||||
this.redisForTimelines.ping(),
|
this.redisForTimelines.ping(),
|
||||||
this.db.query('SELECT 1'),
|
this.db.query('SELECT 1'),
|
||||||
|
...(this.meilisearch ? [this.meilisearch.health()] : []),
|
||||||
]).then(() => 200, () => 503));
|
]).then(() => 200, () => 503));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue