MCPcopy Create free account
hub / github.com/AutoForgeAI/autoforge / _get_session

Function _get_session

registry.py:201–219  ·  view source on GitHub ↗

Context manager for database sessions with automatic commit/rollback. Includes retry logic for SQLite busy database errors. Yields: SQLAlchemy session

()

Source from the content-addressed store, hash-verified

199
200@contextmanager
201def _get_session():
202 """
203 Context manager for database sessions with automatic commit/rollback.
204
205 Includes retry logic for SQLite busy database errors.
206
207 Yields:
208 SQLAlchemy session
209 """
210 _, SessionLocal = _get_engine()
211 session = SessionLocal()
212 try:
213 yield session
214 session.commit()
215 except Exception:
216 session.rollback()
217 raise
218 finally:
219 session.close()
220
221
222def _with_retry(func, *args, **kwargs):

Callers 6

register_projectFunction · 0.85
unregister_projectFunction · 0.85
update_project_pathFunction · 0.85
set_project_concurrencyFunction · 0.85
cleanup_stale_projectsFunction · 0.85
set_settingFunction · 0.85

Calls 2

_get_engineFunction · 0.85
closeMethod · 0.45

Tested by

no test coverage detected