From 4fa78b019f18d4320217f9a0090afef21bd08825 Mon Sep 17 00:00:00 2001 From: Arno Date: Wed, 21 Feb 2024 23:33:33 +0100 Subject: [PATCH] Enable regular autoupdate --- plex-richpresence.go | 11 ++++++++--- plex/main.go | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/plex-richpresence.go b/plex-richpresence.go index 779d9c6..1642c08 100644 --- a/plex-richpresence.go +++ b/plex-richpresence.go @@ -41,7 +41,12 @@ func onReady() { i18n.InitLocale() settings.Load() gui.SetupTray() - autoupdate.Autoupdate() + go func() { + for { + autoupdate.Autoupdate() + time.Sleep(6 * time.Hour) + } + }() ctx, cancelMain := context.WithCancel(context.Background()) go mainFunc(ctx) defer func() { @@ -76,8 +81,8 @@ func onReady() { func disconnectSockets(sockets *map[string]*chan interface{}) { for _, socket := range *sockets { select { - case *socket <- true: - default: + case *socket <- true: + default: } } *sockets = make(map[string]*chan interface{}) diff --git a/plex/main.go b/plex/main.go index 55c17e7..361425e 100644 --- a/plex/main.go +++ b/plex/main.go @@ -235,8 +235,8 @@ func StartWebsocketConnections(server plex.PMSDevices, accountData plex.UserPlex log.Printf("Couldn't connect or lost connection to %s", server.Name) log.Println(err) select { - case cancelChan <- true: - default: + case cancelChan <- true: + default: } onConnectionClose() }