mirror of
https://github.com/unraid/api.git
synced 2026-01-10 10:40:04 -06:00
chore: add logs on disconnect/reconnect of sockets
This commit is contained in:
@@ -54,18 +54,22 @@ export const myservers = () => {
|
||||
if (apiManager.getValidKeys().filter(key => key.name === 'my_servers').length === 0) {
|
||||
// Disconnect forcefully from mothership's subscription endpoint so we ensure it doesn't reconnect automatically
|
||||
mothership.close(true, true);
|
||||
coreLogger.debug('Disconnected mothership\'s subscription endpoint.');
|
||||
|
||||
// Disconnect from relay
|
||||
await sockets.get('relay')?.disconnect(4401);
|
||||
coreLogger.debug('Disconnected mothership\'s relay.');
|
||||
}
|
||||
|
||||
// If we have a my_servers key reconnect to mothership
|
||||
if (apiManager.getValidKeys().filter(key => key.name === 'my_servers').length === 1) {
|
||||
// Reconnect to mothership's subscription endpoint
|
||||
mothership.connect();
|
||||
coreLogger.debug('Reconnecting mothership\'s subscription endpoint.');
|
||||
|
||||
// Reconnect to relay
|
||||
await sockets.get('relay')?.connect();
|
||||
coreLogger.debug('Reconnecting mothership\'s relay.');
|
||||
|
||||
// Reregister all subscriptions
|
||||
// @ts-expect-error
|
||||
|
||||
Reference in New Issue
Block a user