refactor: cleanup sync

This commit is contained in:
zhom
2026-08-10 15:47:31 +04:00
parent 929f5a0ead
commit 325d8fae31
16 changed files with 438 additions and 34 deletions
+13 -3
View File
@@ -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 };
}
}