From 902eaa35ab9cf2cab4963804fd8f702504dc6a66 Mon Sep 17 00:00:00 2001 From: Travis Ralston <travpc@gmail.com> Date: Tue, 1 Aug 2023 22:03:04 -0600 Subject: [PATCH] Fix stall on shutdown when the config was reloaded 2+ times --- CHANGELOG.md | 3 ++- cmd/media_repo/reloads.go | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b39eddb0..4012c30e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -121,7 +121,8 @@ path/server, for example, then you can simply update the path in the config for * URL previews now follow redirects properly. * Overall memory usage is improved, particularly during media uploads. - * Note: If you use plugins then memory usage will still be somewhat high due to temporary caching of uploads. + * Note: If you use plugins then memory usage will still be somewhat high due to temporary caching of uploads. +* Fixed shutdown stall if the config was reloaded more than once while running. ## [1.2.13] - February 12, 2023 diff --git a/cmd/media_repo/reloads.go b/cmd/media_repo/reloads.go index f1e8eda1..d197cd76 100644 --- a/cmd/media_repo/reloads.go +++ b/cmd/media_repo/reloads.go @@ -121,6 +121,8 @@ func reloadAccessTokensOnChan(reloadChan chan bool) { shouldReload := <-reloadChan if shouldReload { _auth_cache.FlushCache() + } else { + return // received stop } } }() @@ -135,6 +137,7 @@ func reloadCacheOnChan(reloadChan chan bool) { redislib.Reconnect() } else { redislib.Stop() + return // received stop } } }() @@ -149,6 +152,7 @@ func reloadPluginsOnChan(reloadChan chan bool) { plugins.ReloadPlugins() } else { plugins.StopPlugins() + return // received stop } } }() @@ -163,6 +167,7 @@ func reloadPoolOnChan(reloadChan chan bool) { pool.AdjustSize() } else { pool.Drain() + return // received stop } } }() @@ -175,6 +180,8 @@ func reloadErrorCachesOnChan(reloadChan chan bool) { shouldReload := <-reloadChan if shouldReload { errcache.AdjustSize() + } else { + return // received stop } } }() -- GitLab