Spaces:
Sleeping
Sleeping
Updated the load invoice to see the old history of patient
Browse files
core/__pycache__/database.cpython-313.pyc
CHANGED
|
Binary files a/core/__pycache__/database.cpython-313.pyc and b/core/__pycache__/database.cpython-313.pyc differ
|
|
|
core/database.py
CHANGED
|
@@ -8,7 +8,12 @@ load_dotenv()
|
|
| 8 |
|
| 9 |
DATABASE_URL = os.getenv("DATABASE_URL")
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
| 13 |
Base = declarative_base()
|
| 14 |
|
|
@@ -18,4 +23,4 @@ def get_db():
|
|
| 18 |
try:
|
| 19 |
yield db
|
| 20 |
finally:
|
| 21 |
-
db.close()
|
|
|
|
| 8 |
|
| 9 |
DATABASE_URL = os.getenv("DATABASE_URL")
|
| 10 |
|
| 11 |
+
# HF/Neon can drop idle connections; pre_ping + recycle avoids stale connections.
|
| 12 |
+
engine = create_engine(
|
| 13 |
+
DATABASE_URL,
|
| 14 |
+
pool_pre_ping=True,
|
| 15 |
+
pool_recycle=300,
|
| 16 |
+
)
|
| 17 |
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
| 18 |
Base = declarative_base()
|
| 19 |
|
|
|
|
| 23 |
try:
|
| 24 |
yield db
|
| 25 |
finally:
|
| 26 |
+
db.close()
|