Sep 4 - Add link relavant issues function

This commit is contained in:
2026-09-04 16:53:53 -04:00
parent d291dfc513
commit e9005b9b9c
20 changed files with 3208 additions and 72 deletions
+36
View File
@@ -31,6 +31,42 @@ class Config:
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_ECHO = False
# ── Connection pool (default bind) ──────────────────────────────────────
# These apply to the DEFAULT engine built from SQLALCHEMY_DATABASE_URI —
# the one used in single-tenant mode, on tenant-exempt paths, and as the
# fallback bind. PER-TENANT engines are built in
# app/tenancy/engine_cache.py and carry their own (deliberately smaller)
# TENANT_ENGINE_* pool settings; changing these does not affect those.
#
# Without them the pool runs on library defaults, which is where the
# intermittent OperationalError 2006 ("MySQL server has gone away") comes
# from: MySQL closes a connection after wait_timeout (8h by default) and
# SQLAlchemy hands the dead socket to the next request.
#
# pool_pre_ping — cheap liveness check before a connection is handed out;
# a dead one is discarded and replaced transparently.
# pool_recycle — retire connections after 30 min, well under any sane
# wait_timeout, so they are never the stale ones.
# pool_size / — Gunicorn runs sync workers (cpu*2+1), and each worker
# max_overflow holds its OWN pool. Library defaults (5 + 10) mean a
# 9-worker box can open 135 connections against a
# max_connections of 151 — before the per-tenant pools
# are counted at all. A sync worker serves one request at
# a time, so it needs one connection in steady state; the
# small overflow is headroom for background
# email/notification threads.
#
# Tune with scripts/db_health.py, which cross-checks these (and the
# per-tenant pools) against the server's live max_connections and
# wait_timeout.
SQLALCHEMY_ENGINE_OPTIONS = {
'pool_pre_ping': True,
'pool_recycle': int(os.environ.get('DB_POOL_RECYCLE', '1800')),
'pool_size': int(os.environ.get('DB_POOL_SIZE', '5')),
'max_overflow': int(os.environ.get('DB_MAX_OVERFLOW', '5')),
'pool_timeout': 30,
}
# ── Multi-tenancy (MT-1) ─────────────────────────────────────────────────
# Master switch. When False (default) the app behaves EXACTLY as the
# single-tenant deployment: no Host resolution, every query uses