Merge pull request #460 from eitchtee/dev

fix: try to fix stale database connections (again)
This commit is contained in:
Herculino Trotta
2025-12-19 22:02:03 -03:00
committed by GitHub
3 changed files with 17 additions and 6 deletions

View File

@@ -143,6 +143,9 @@ WSGI_APPLICATION = "WYGIWYH.wsgi.application"
# Database
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
THREADS = int(os.getenv("GUNICORN_THREADS", 1))
MAX_POOL_SIZE = THREADS + 1
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
@@ -151,8 +154,16 @@ DATABASES = {
"PASSWORD": os.getenv("SQL_PASSWORD", "password"),
"HOST": os.getenv("SQL_HOST", "localhost"),
"PORT": os.getenv("SQL_PORT", "5432"),
"CONN_MAX_AGE": 0,
"CONN_HEALTH_CHECKS": True,
"OPTIONS": {
"pool": True,
"pool": {
"min_size": 1,
"max_size": MAX_POOL_SIZE,
"timeout": 10,
"max_lifetime": 600,
"max_idle": 300,
},
},
}
}

View File

@@ -137,13 +137,13 @@ class UserSettingsForm(forms.ModelForm):
self.helper.layout = Layout(
"language",
"timezone",
HTML("<hr />"),
HTML('<hr class="hr my-3" />'),
"date_format",
"datetime_format",
"number_format",
HTML("<hr />"),
HTML('<hr class="hr my-3" />'),
"start_page",
HTML("<hr />"),
HTML('<hr class="hr my-3" />'),
"volume",
FormActions(
NoClassSubmit("submit", _("Save"), css_class="btn btn-primary"),

View File

@@ -1,7 +1,7 @@
{% if field.help_text %}
{% if help_text_inline %}
<span id="{{ field.auto_id }}_helptext" class="label text-wrap">{{ field.help_text|safe}}</span>
<span id="{{ field.auto_id }}_helptext" class="label text-wrap block">{{ field.help_text|safe}}</span>
{% else %}
<p {% if field.auto_id %}id="{{ field.auto_id }}_helptext" {% endif %}class="label text-wrap">{{ field.help_text|safe }}</p>
<p {% if field.auto_id %}id="{{ field.auto_id }}_helptext" {% endif %}class="label text-wrap block">{{ field.help_text|safe }}</p>
{% endif %}
{% endif %}