aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/subscriptions.py
diff options
context:
space:
mode:
authorAstounds <kirito@disroot.org>2026-03-28 16:06:47 -0500
committerAstounds <kirito@disroot.org>2026-03-28 16:06:47 -0500
commitfa7273b328b8cea8b051917f5255a1a712a9e1b9 (patch)
treec52212a4675792556c7e595dc4c8a3b3c8e187e4 /youtube/subscriptions.py
parenta0d10e6a007e6191f1fa34174fd08f4f2c3e580b (diff)
downloadyt-local-fa7273b328b8cea8b051917f5255a1a712a9e1b9.tar.lz
yt-local-fa7273b328b8cea8b051917f5255a1a712a9e1b9.tar.xz
yt-local-fa7273b328b8cea8b051917f5255a1a712a9e1b9.zip
fix: race condition in os.makedirs causing worker crashes
Replace check-then-create pattern with exist_ok=True to prevent FileExistsError when multiple workers initialize simultaneously. Affects: - subscriptions.py: open_database() - watch.py: save_decrypt_cache() - local_playlist.py: add_to_playlist() - util.py: fetch_url(), get_visitor_data() - settings.py: initialization Fixes Gunicorn worker startup failures in multi-worker deployments.
Diffstat (limited to 'youtube/subscriptions.py')
-rw-r--r--youtube/subscriptions.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/youtube/subscriptions.py b/youtube/subscriptions.py
index 3326a51..980822a 100644
--- a/youtube/subscriptions.py
+++ b/youtube/subscriptions.py
@@ -30,8 +30,7 @@ database_path = os.path.join(settings.data_dir, "subscriptions.sqlite")
def open_database():
- if not os.path.exists(settings.data_dir):
- os.makedirs(settings.data_dir)
+ os.makedirs(settings.data_dir, exist_ok=True)
connection = sqlite3.connect(database_path, check_same_thread=False)
try: