Sort out error handling

pull/155/head
Erik Johnston 2015-05-15 11:00:50 +01:00
parent a2c4f3f150
commit de01438a57
1 changed files with 22 additions and 25 deletions

View File

@ -502,8 +502,8 @@ class EventsStore(SQLBaseStore):
def _do_fetch(self, conn):
event_list = []
try:
while True:
try:
logger.debug("do_fetch getting lock")
with self._event_fetch_lock:
logger.debug("do_fetch go lock: %r", self._event_fetch_list)
@ -561,7 +561,6 @@ class EventsStore(SQLBaseStore):
defer.returnValue({})
events_d = defer.Deferred()
try:
logger.debug("enqueueueueue getting lock")
with self._event_fetch_lock:
logger.debug("enqueue go lock")
@ -569,21 +568,19 @@ class EventsStore(SQLBaseStore):
(events, events_d)
)
if self._event_fetch_ongoing < 1:
self._event_fetch_ongoing += 1
should_start = True
else:
should_start = False
if should_start:
self.runWithConnection(
self._do_fetch
)
except Exception as e:
if not events_d.called:
events_d.errback(e)
logger.debug("events_d before")
try:
rows = yield events_d
except:
logger.exception("events_d")
logger.debug("events_d after")
res = yield defer.gatherResults(