healthcheck crashes with local file storage (#16944)

* Update api/src/services/server.ts
* remove try catch in write
* Update api/src/services/server.ts

Co-authored-by: Freekrai <freekrai@users.noreply.github.com>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
This commit is contained in:
Roger Stringer
2023-01-06 07:17:04 -08:00
committed by GitHub
parent daf931a442
commit c429ecd57c

View File

@@ -308,8 +308,11 @@ export class ServerService {
try {
await disk.write(`health-${checkID}`, Readable.from(['check']));
await disk.read(`health-${checkID}`);
await disk.delete(`health-${checkID}`);
const fileStream = await disk.read(`health-${checkID}`);
fileStream.on('data', async () => {
fileStream.destroy();
await disk.delete(`health-${checkID}`);
});
} catch (err: any) {
checks[`storage:${location}:responseTime`][0].status = 'error';
checks[`storage:${location}:responseTime`][0].output = err;