Improve database concurrency
Django CI/CD / test (push) Successful in 1m7s Details
Django CI/CD / build-and-push (push) Successful in 1m58s Details

This commit is contained in:
Lukáš Kucharczyk 2025-01-30 16:53:30 +01:00
parent 6f62889e92
commit 2f4e16dd54
Signed by: lukas
SSH Key Fingerprint: SHA256:vMuSwvwAvcT6htVAioMP7rzzwMQNi3roESyhv+nAxeg
2 changed files with 6 additions and 0 deletions

View File

@ -26,6 +26,7 @@ def schedule_tasks(sender, **kwargs):
name="Update converted prices", name="Update converted prices",
schedule_type=Schedule.MINUTES, schedule_type=Schedule.MINUTES,
next_run=now() + timedelta(seconds=30), next_run=now() + timedelta(seconds=30),
catchup=False,
) )
if not Schedule.objects.filter(name="Update price per game").exists(): 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", name="Update price per game",
schedule_type=Schedule.MINUTES, schedule_type=Schedule.MINUTES,
next_run=now() + timedelta(seconds=30), next_run=now() + timedelta(seconds=30),
catchup=False,
) )
from games.models import ExchangeRate from games.models import ExchangeRate

View File

@ -113,6 +113,10 @@ DATABASES = {
"default": { "default": {
"ENGINE": "django.db.backends.sqlite3", "ENGINE": "django.db.backends.sqlite3",
"NAME": BASE_DIR / "db.sqlite3", "NAME": BASE_DIR / "db.sqlite3",
"OPTIONS": {
"timeout": 20,
"init_command": "PRAGMA synchronous=NORMAL; PRAGMA journal_mode=WAL;",
},
} }
} }