Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 977203d

Browse files
committed
Make sure the storage is thread safe.
1 parent ace58db commit 977203d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/oidcmsg/storage/absqlalchemy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import json
33

44
import sqlalchemy as alchemy_db
5-
from sqlalchemy.orm import sessionmaker
5+
from sqlalchemy.orm import sessionmaker, scoped_session
66

77
PlainDict = dict
88

@@ -15,7 +15,7 @@ def __init__(self, conf_dict):
1515
self.metadata, autoload=True,
1616
autoload_with=self.engine)
1717
Session = sessionmaker(bind=self.engine)
18-
self.session = Session()
18+
self.session = scoped_session(Session)
1919

2020
def get(self, k):
2121
entry = self.session.query(self.table).filter_by(owner=k).first()
@@ -86,4 +86,4 @@ def flush(self):
8686
self.session.flush()
8787

8888
def __setitem__(self, k, v):
89-
return self.set(k, v)
89+
return self.set(k, v)

0 commit comments

Comments
 (0)