Skip to content

Conversation

zikcheng
Copy link
Contributor

When casbin.Enforcer is created, Adapter.load_policy() will be called,
but sqlalchemy session is not commited in Adapter.load_policy(). The
connection to database is held all the time till the first database
operation, if the time interval between casbin.Enforcer created and
first database operation occurs, exceeds database timeout setting, database
operations like add_policy() and remove_policy() will raise timeout
exception.

When casbin.Enforcer is created, Adapter.load_policy() will be called,
but sqlalchemy session is not commited in Adapter.load_policy(). The
connection to database is held all the time till the first database
operation, if the time interval between casbin.Enforcer created and
first database operation occurs, exceeds database timeout setting, database
operations like add_policy() and remove_policy() will raise timeout
exception.
@hsluoyz
Copy link
Member

hsluoyz commented Sep 30, 2020

@techoner @Xhy-5000 please review.

@Xhy-5000
Copy link

LGTM.

@hsluoyz
Copy link
Member

hsluoyz commented Oct 3, 2020

@techoner can you merge it?

@leeqvip leeqvip merged commit df6dcb5 into pycasbin:master Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants