Skip to content
This repository has been archived by the owner on Apr 9, 2023. It is now read-only.

Commit

Permalink
Revert b2693ea
Browse files Browse the repository at this point in the history
  • Loading branch information
datakurre committed Nov 17, 2016
1 parent 2ff77a1 commit c3812a0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 33 deletions.
2 changes: 1 addition & 1 deletion config-zodb.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"zodb1": {
"storage": "ZODB",
"path": "data/zeo.fs",
"path": "data/Data.fs",
"configuration": {
"pool_size": 100,
"cache_size": 100
Expand Down
27 changes: 8 additions & 19 deletions src/plone.server/plone/server/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,14 +335,9 @@ def make_app(config_file=None, settings=None):
fs = ZODB.FileStorage.FileStorage(dbconfig['path'])

db = DB(fs)
try:
if not IDataBase.providedBy(root):
alsoProvides(db.open().root(), IDataBase)
transaction.commit()
except:
pass
finally:
db.close()
alsoProvides(db.open().root(), IDataBase)
transaction.commit()
db.close()
# Set request aware database for app
db = RequestAwareDB(dbconfig['path'], **config)
dbo = DataBase(key, db)
Expand All @@ -352,14 +347,10 @@ def make_app(config_file=None, settings=None):

cs = ClientStorage(address)
db = DB(cs)
try:
if not IDataBase.providedBy(root):
alsoProvides(db.open().root(), IDataBase)
transaction.commit()
except:
pass
finally:
db.close()

alsoProvides(db.open().root(), IDataBase)
transaction.commit()
db.close()

# Set request aware database for app
cs = ClientStorage(address)
Expand All @@ -368,9 +359,7 @@ def make_app(config_file=None, settings=None):
elif dbconfig['storage'] == 'DEMO':
storage = DemoStorage(name=dbconfig['name'])
db = DB(storage)
root = db.open().root()
if not IDataBase.providedBy(root):
alsoProvides(db.open().root(), IDataBase)
alsoProvides(db.open().root(), IDataBase)
transaction.commit()
db.close()
# Set request aware database for app
Expand Down
2 changes: 1 addition & 1 deletion src/plone.server/plone/server/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def savepoint(self):


class RequestAwareConnection(ZODB.Connection.Connection):
executor = ThreadPoolExecutor(max_workers=1)
executor = ThreadPoolExecutor(max_workers=100)
lock = threading.Lock()

def _getReadCurrent(self):
Expand Down
15 changes: 3 additions & 12 deletions src/plone.server/plone/server/traversal.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,20 +190,11 @@ async def handler(self, request):
async with locked(self.resource):
view_result = await self.view()
if isinstance(view_result, ErrorResponse):
if SHARED_CONNECTION is False:
txn.abort()
else:
await sync(request)(txn.abort)
await sync(request)(txn.abort)
elif isinstance(view_result, UnauthorizedResponse):
if SHARED_CONNECTION is False:
txn.abort()
else:
await sync(request)(txn.abort)
await sync(request)(txn.abort)
else:
if SHARED_CONNECTION is False:
txn.commit()
else:
await sync(request)(txn.commit)
await sync(request)(txn.commit)
except Unauthorized:
await sync(request)(txn.abort)
view_result = UnauthorizedResponse(
Expand Down

0 comments on commit c3812a0

Please sign in to comment.