Skip to content

Commit

Permalink
Avoid tracebacks if acquire_write times out.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajdavis committed Apr 19, 2015
1 parent 4cbf78b commit 812132b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions toro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -920,8 +920,16 @@ def acquire_write(self, deadline=None):
(as returned by ``io_loop.time()``) or a ``datetime.timedelta`` for
a deadline relative to the current time.
"""
managers = yield [self._block.acquire(deadline) for _ in
xrange(self._max_readers)]
futures = [self._block.acquire(deadline) for _ in
xrange(self._max_readers)]
try:
managers = yield futures
except Timeout:
for f in futures:
# Avoid traceback logging.
f.exception()
raise

raise gen.Return(_ContextManagerList(managers))

def release_read(self):
Expand Down

0 comments on commit 812132b

Please sign in to comment.