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

Commit

Permalink
cleaning actual code base of debug messages and a maximum number of r…
Browse files Browse the repository at this point in the history
…etries
  • Loading branch information
Ramon Navarro Bosch committed Mar 9, 2017
1 parent b4ff481 commit 5895a0d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ install:
- sleep 15
script:
- bin/py.test -s --cov=plone.server -v --cov-report term-missing src
- bin/code-analysis
after_success:
- coveralls
- cat .coverage
12 changes: 7 additions & 5 deletions src/plone.server/plone/server/traversal.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
import traceback
import uuid

MAX_RETRIES = 10


async def do_traverse(request, parent, path):
"""Traverse for the code API."""
Expand Down Expand Up @@ -132,11 +134,13 @@ async def traverse(request, parent, path):
request.conn = context.conn
else:
# Create a new conection
count = 0
while len(context._db.pool.all) > context._db.pool._size + 5:
context._db.pool._reduce_size(strictly_less=True)
await asyncio.sleep(2)
print('BEFORE AVAILABLE: %d' % len(context._db.pool.available))
print('ALL CONNECTIONS: %d' % len(context._db.pool.all))
await asyncio.sleep(1)
count += 1
if count > MAX_RETRIES:
raise Exception('No more connections')
request.conn = context.open()
# Check the transaction
request._db_write_enabled = False
Expand Down Expand Up @@ -249,8 +253,6 @@ async def handler(self, request):
# If we want to close the connection after the request
if SHARED_CONNECTION is False and hasattr(request, 'conn'):
request.conn.close()
print('AFTER AVAILABLE: %d' % len(request.conn._db.pool.available))
print('AFTER ALL CONNECTIONS: %d' % len(request.conn._db.pool.all))


# Make sure its a Response object to send to renderer
Expand Down

0 comments on commit 5895a0d

Please sign in to comment.