misc: use BEGIN IMMEDIATE to start transactions (#89314)
gitea/ants-hub/pipeline/head This commit looks good
Details
gitea/ants-hub/pipeline/head This commit looks good
Details
This commit is contained in:
parent
a8553f0c72
commit
be65c4b929
|
@ -13,7 +13,7 @@ MEDIA_ROOT = os.path.join(VAR_DIR, 'media')
|
|||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'ENGINE': 'ants_hub.sqlite3_backend',
|
||||
'NAME': os.path.join(VAR_DIR, 'db.sqlite3'),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# Databases
|
||||
# DATABASES = {
|
||||
# 'default': {
|
||||
# 'ENGINE': 'django.db.backends.sqlite3',
|
||||
# 'ENGINE': 'ants_hub.sqlite3_backend',
|
||||
# 'NAME': os.path.join(VAR_DIR, 'db.sqlite3'),
|
||||
# }
|
||||
# }
|
||||
|
|
|
@ -63,7 +63,7 @@ WSGI_APPLICATION = 'ants_hub.wsgi.application'
|
|||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'ENGINE': 'ants_hub.sqlite3_backend',
|
||||
'NAME': 'db.sqlite3',
|
||||
# Keep database open
|
||||
'CONN_MAX_AGE': None,
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
# ANTS-Hub - Copyright (C) Entr'ouvert
|
||||
|
||||
from django.db.backends.sqlite3 import base
|
||||
|
||||
|
||||
class DatabaseWrapper(base.DatabaseWrapper):
|
||||
def _start_transaction_under_autocommit(self):
|
||||
"""
|
||||
Start a transaction explicitly in autocommit mode.
|
||||
|
||||
Staying in autocommit mode works around a bug of sqlite3 that breaks
|
||||
savepoints when autocommit is disabled.
|
||||
"""
|
||||
self.cursor().execute('BEGIN IMMEDIATE')
|
Loading…
Reference in New Issue