🐛 oo-connector: do not crash if getting a health request before onlyoffice awake (#678)

because of my bug in the health endpoint, requesting it before
onlyoffice is functioning caused the connector to crash
This commit is contained in:
ericlinagora
2024-10-03 15:36:35 +02:00
committed by GitHub
@@ -28,14 +28,18 @@ class ForgottenProcessor implements IHealthProvider {
}
public async getHealthData() {
const keys = await onlyofficeService.getForgottenList();
return {
forgotten: {
timeSinceLastStartS: this.lastStart ? ~~((new Date().getTime() - this.lastStart) / 1000) : -1,
count: keys?.length ?? 0,
locks: this.forgottenSynchroniser.getWorstStats(),
},
};
try {
const keys = await onlyofficeService.getForgottenList();
return {
forgotten: {
timeSinceLastStartS: this.lastStart ? ~~((new Date().getTime() - this.lastStart) / 1000) : -1,
count: keys?.length ?? 0,
locks: this.forgottenSynchroniser.getWorstStats(),
},
};
} catch (e) {
return { forgotten: 'Error' };
}
}
/**