mirror of
https://github.com/bugsink/bugsink.git
synced 2025-12-30 18:00:17 -06:00
@@ -7,6 +7,7 @@ import threading
|
||||
|
||||
from django.db import transaction as django_db_transaction
|
||||
from django.db import DEFAULT_DB_ALIAS
|
||||
from django.conf import settings
|
||||
|
||||
from snappea.settings import get_settings as get_snappea_settings
|
||||
|
||||
@@ -218,6 +219,17 @@ def immediate_atomic(using=None, savepoint=True, durable=True):
|
||||
# case.
|
||||
with immediate_atomic:
|
||||
yield
|
||||
|
||||
elif "sqlite" not in settings.DATABASES[using]["ENGINE"]:
|
||||
# The SemaphoreContext was added specifically to address the WAL growth issue in sqlite; better not to use it
|
||||
# for other database backends; in particular, if such databases have longer default timeouts, then the error
|
||||
# message may be confusing (semaphore timeout after 10s throws an error... while the thread that hogs the DB
|
||||
# is _not_ (yet) timed out)
|
||||
#
|
||||
# in-string matching matches both our 'timed' backend and the django default.
|
||||
with immediate_atomic:
|
||||
yield
|
||||
|
||||
else:
|
||||
# https://stackoverflow.com/a/45681273/339144 provides some context on nesting context managers; and how to
|
||||
# proceed if you want to do this with an arbitrary number of context managers.
|
||||
|
||||
Reference in New Issue
Block a user