Merge pull request #1268 from paperless-ngx/bugfix-db-locked

Bugfix: Adds configuration for database timeout, fixing database locked error
This commit is contained in:
shamoon
2022-07-26 09:44:42 -07:00
committed by GitHub
4 changed files with 51 additions and 9 deletions

View File

@@ -338,6 +338,13 @@ if os.getenv("PAPERLESS_DBHOST"):
if os.getenv("PAPERLESS_DBPORT"):
DATABASES["default"]["PORT"] = os.getenv("PAPERLESS_DBPORT")
if os.getenv("PAPERLESS_DB_TIMEOUT") is not None:
_new_opts = {"timeout": float(os.getenv("PAPERLESS_DB_TIMEOUT"))}
if "OPTIONS" in DATABASES["default"]:
DATABASES["default"]["OPTIONS"].update(_new_opts)
else:
DATABASES["default"]["OPTIONS"] = _new_opts
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
###############################################################################