Merge remote-tracking branch 'origin/upload-ok'

This commit is contained in:
Alan Grainger
2026-10-19 14:43:13 +13:00
7 changed files with 77 additions and 19 deletions
+13 -6
View File
@@ -37,15 +37,22 @@ export function abortOnClose (res: Response): AbortSignal {
return controller.signal
}
/** `GET /healthcheck`: `ok` while Immich answers, else 503. */
export async function healthcheck (_req: Request, res: Response): Promise<void> {
if (await accessible()) {
res.send('ok')
} else {
res.status(503).send()
/**
* A `GET /healthcheck` handler: `body` while Immich answers, else 503.
*/
export function healthcheckHandler (body: string) {
return async (_req: Request, res: Response): Promise<void> => {
if (await accessible()) {
res.send(body)
} else {
res.status(503).send()
}
}
}
/** IPP's `GET /healthcheck`: `ok` while Immich answers, else 503. */
export const healthcheck = healthcheckHandler('ok')
/**
* Wrap an async route handler so a rejected promise is passed to Express's
* error chain (and on to `errorHandler`).