summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormorpheus65535 <[email protected]>2022-09-22 17:16:18 -0400
committermorpheus65535 <[email protected]>2022-09-22 17:16:18 -0400
commitd3defa2e09e93ef4340f740f9acfa327914b5c42 (patch)
treef04d06722c1cc68716ccbc8c4e74941f029c4c6a
parent4826cb84875a3aadeaae1e01eac0baef3dc16fad (diff)
downloadbazarr-d3defa2e09e93ef4340f740f9acfa327914b5c42.tar.gz
bazarr-d3defa2e09e93ef4340f740f9acfa327914b5c42.zip
Added update mechanism sooner in the startup process to recover from a failed update more easily once a fixed release is available.
-rw-r--r--bazarr/main.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/bazarr/main.py b/bazarr/main.py
index 9a2b49cc3..cb26b3635 100644
--- a/bazarr/main.py
+++ b/bazarr/main.py
@@ -2,6 +2,8 @@
import os
+from threading import Thread
+
bazarr_version = 'unknown'
version_file = os.path.join(os.path.dirname(__file__), '..', 'VERSION')
@@ -14,23 +16,30 @@ os.environ["BAZARR_VERSION"] = bazarr_version.lstrip('v')
import app.libs # noqa W0611
-from threading import Thread # noqa E402
-
from app.get_args import args # noqa E402
+from app.check_update import apply_update, check_releases, check_if_new_update # noqa E402
from app.config import settings, configure_proxy_func, base_url # noqa E402
+
+# Install downloaded update
+if bazarr_version != '':
+ apply_update()
+
+# Check for new update and install latest
+if args.no_update or not settings.general.getboolean('auto_update'):
+ # user have explicitly requested that we do not update or is using some kind of package/docker that prevent it
+ check_releases()
+else:
+ # we want to update to the latest version before loading too much stuff. This should prevent deadlock when
+ # there's missing embedded packages after a commit
+ check_if_new_update()
+
from init import * # noqa E402
from app.database import System # noqa E402
from app.notifier import update_notifier # noqa E402
from languages.get_languages import load_language_in_db # noqa E402
from app.signalr_client import sonarr_signalr_client, radarr_signalr_client # noqa E402
-from app.check_update import apply_update, check_releases # noqa E402
from app.server import webserver # noqa E402
-# Install downloaded update
-if bazarr_version != '':
- apply_update()
-check_releases()
-
configure_proxy_func()
# Reset the updated once Bazarr have been restarted after an update