From 2f4e16dd54312699bcb6426f4da1fa7a04feacda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Thu, 30 Jan 2025 16:53:30 +0100 Subject: [PATCH] Improve database concurrency --- games/apps.py | 2 ++ timetracker/settings.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/games/apps.py b/games/apps.py index 0cc802d..4cd6420 100644 --- a/games/apps.py +++ b/games/apps.py @@ -26,6 +26,7 @@ def schedule_tasks(sender, **kwargs): name="Update converted prices", schedule_type=Schedule.MINUTES, next_run=now() + timedelta(seconds=30), + catchup=False, ) if not Schedule.objects.filter(name="Update price per game").exists(): @@ -34,6 +35,7 @@ def schedule_tasks(sender, **kwargs): name="Update price per game", schedule_type=Schedule.MINUTES, next_run=now() + timedelta(seconds=30), + catchup=False, ) from games.models import ExchangeRate diff --git a/timetracker/settings.py b/timetracker/settings.py index 5cc6dda..c948874 100644 --- a/timetracker/settings.py +++ b/timetracker/settings.py @@ -113,6 +113,10 @@ DATABASES = { "default": { "ENGINE": "django.db.backends.sqlite3", "NAME": BASE_DIR / "db.sqlite3", + "OPTIONS": { + "timeout": 20, + "init_command": "PRAGMA synchronous=NORMAL; PRAGMA journal_mode=WAL;", + }, } }