handle errors when sending pings
This commit is contained in:
@@ -78,8 +78,8 @@ export function forgetSubscription(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AUDIT
|
// AUDIT
|
||||||
export function getWebSocketStats(): [string, string|number][] {
|
export function getWebSocketStats(): [string, string | number][] {
|
||||||
function listString<T>(list: Set<T>|Map<string, T>, map: (x: T) => string): string {
|
function listString<T>(list: Set<T> | Map<string, T>, map: (x: T) => string): string {
|
||||||
if (list.size == 0) return "<none>";
|
if (list.size == 0) return "<none>";
|
||||||
return [...list.values()].map(map).join("\n");
|
return [...list.values()].map(map).join("\n");
|
||||||
}
|
}
|
||||||
@@ -103,8 +103,10 @@ export function connectServers(config: typeof defaultConfig): void {
|
|||||||
export function reconnectServers(config: typeof defaultConfig): void {
|
export function reconnectServers(config: typeof defaultConfig): void {
|
||||||
config.connectedServers
|
config.connectedServers
|
||||||
.map(address => address.replace("ws", "http"))
|
.map(address => address.replace("ws", "http"))
|
||||||
.forEach(address => {
|
.forEach(async address => {
|
||||||
fetch(address);
|
try {
|
||||||
|
await fetch(address);
|
||||||
|
} catch (error) { writeError(`failed to ping server at "${address}": ${error}`) }
|
||||||
});
|
});
|
||||||
|
|
||||||
[...serversDisconnected.values()].forEach((address) => {
|
[...serversDisconnected.values()].forEach((address) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user