Detect timeouts as server down

This commit is contained in:
Cadence Ember
2026-07-15 16:37:23 +12:00
parent a8712b635d
commit d4cd580555
2 changed files with 9 additions and 1 deletions
+5
View File
@@ -181,9 +181,14 @@ async function onPacket(client, message, listen) {
// Event dispatcher for OOYE bridge operations // Event dispatcher for OOYE bridge operations
if (listen === "full" && message.t) { if (listen === "full" && message.t) {
const alwaysRealTimeEvents = ["PRESENCE_UPDATE"] const alwaysRealTimeEvents = ["PRESENCE_UPDATE"]
const optionalEvents = ["TYPING_START"]
if (alwaysRealTimeEvents.includes(message.t) || homeserverStatus.homeserverStatus.isRealTime()) { if (alwaysRealTimeEvents.includes(message.t) || homeserverStatus.homeserverStatus.isRealTime()) {
// real time
dispatchPacketToBridge(client, message) dispatchPacketToBridge(client, message)
} else if (optionalEvents.includes(message.t)) {
// when not real time, skip optional events
} else { } else {
// queue required events
homeserverStatus.homeserverStatus.queuePacket(message) homeserverStatus.homeserverStatus.queuePacket(message)
} }
} }
+4 -1
View File
@@ -171,7 +171,10 @@ async function sendError(roomID, source, type, e, payload) {
} }
}) })
} catch (e) { } catch (e) {
if (e instanceof mreq.MatrixServerError && [502, 503].includes(e.httpStatus) && e.errcode === "CX_SERVER_ERROR") { if (
e.toString().includes("fetch failed")
|| (e instanceof mreq.MatrixServerError && [502, 503].includes(e.httpStatus) && e.errcode === "CX_SERVER_ERROR")
) {
// Matrix homeserver is down (reverse proxy indicated failure) // Matrix homeserver is down (reverse proxy indicated failure)
homeserverStatus.homeserverStatus.setErrorWithPacket(payload) homeserverStatus.homeserverStatus.setErrorWithPacket(payload)
} }