Skip to content

Commit

Permalink
Merge pull request #162 from pagreene/protection-fix
Browse files Browse the repository at this point in the history
Re-implement session protection.
  • Loading branch information
pagreene committed Feb 3, 2021
2 parents ca2fce9 + 993b229 commit e5836ed
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions indra_db/databases.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,11 @@ def grab_session(self):
return
if self.session is None or not self.session.is_active:
logger.debug('Attempting to get session...')
DBSession = sessionmaker(bind=self.__engine,
autoflush=not self.__protected,
autocommit=not self.__protected)
if not self.__protected:
DBSession = sessionmaker(bind=self.__engine)
else:
DBSession = sessionmaker(bind=self.__engine, autoflush=False,
autocommit=False)
logger.debug('Got session.')
self.session = DBSession()
if self.session is None:
Expand Down

0 comments on commit e5836ed

Please sign in to comment.