mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-15 05:53:00 +00:00
Don't expire objects on commit
This commit is contained in:
@@ -599,5 +599,9 @@ def new_session_factory(url="sqlite:///:memory:", reset=False, **kwargs):
|
||||
check_db_revision(engine)
|
||||
Base.metadata.create_all(engine)
|
||||
|
||||
session_factory = sessionmaker(bind=engine)
|
||||
# We set expire_on_commit=False, since we don't actually need
|
||||
# SQLAlchemy to expire objects after commiting - we don't expect
|
||||
# concurrent runs of the hub talking to the same db. Turning
|
||||
# this off gives us a major performance boost
|
||||
session_factory = sessionmaker(bind=engine, expire_on_commit=False)
|
||||
return session_factory
|
||||
|
Reference in New Issue
Block a user