Skip to content

Commit

Permalink
Use close_resets_only=False for extra safety
Browse files Browse the repository at this point in the history
  • Loading branch information
nick8325 committed Feb 6, 2024
1 parent 6ab1b15 commit aeec8da
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion karp-backend/src/karp/main/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ def install_auth_service( # noqa: ANN201, D103


def with_new_session(container: injector.Injector): # noqa: ANN201, D103
session = Session(bind=container.get(Engine))
session = Session(bind=container.get(Engine), close_resets_only=True)
# Note on close_resets_only=False: this will detect cases where we call close()
# while another piece of code is still using the session. If you plan to remove this,
# be careful about the cache in SqlResourceRepository.

def configure_child(binder): # noqa: ANN202
binder.bind(Session, to=injector.InstanceProvider(session))
Expand Down

0 comments on commit aeec8da

Please sign in to comment.