mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-08-12 22:20:31 +02:00
refactor: cleanup sync
This commit is contained in:
@@ -19,15 +19,25 @@ export class AppController {
|
||||
return { status: "ok" };
|
||||
}
|
||||
|
||||
// `storageEndpoint` is the host clients are handed in presigned URLs. The
|
||||
// server cannot tell whether a client can reach it, so report it and let
|
||||
// whoever is debugging a failing sync compare it against their network.
|
||||
// Self-hosted only — see getDiagnosticStorageEndpoint.
|
||||
@Get("readyz")
|
||||
async getReadiness(): Promise<{ status: string; s3: boolean }> {
|
||||
async getReadiness(): Promise<{
|
||||
status: string;
|
||||
s3: boolean;
|
||||
storageEndpoint?: string;
|
||||
}> {
|
||||
const s3Ready = await this.syncService.checkS3Connectivity();
|
||||
const storageEndpoint = this.syncService.getDiagnosticStorageEndpoint();
|
||||
const diagnostic = storageEndpoint ? { storageEndpoint } : {};
|
||||
if (!s3Ready) {
|
||||
throw new HttpException(
|
||||
{ status: "not ready", s3: false },
|
||||
{ status: "not ready", s3: false, ...diagnostic },
|
||||
HttpStatus.SERVICE_UNAVAILABLE,
|
||||
);
|
||||
}
|
||||
return { status: "ready", s3: true };
|
||||
return { status: "ready", s3: true, ...diagnostic };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user