Srsly. Don't use closures. Baaaaaad

pull/155/head
Erik Johnston 2015-05-15 11:26:00 +01:00
parent 575ec91d82
commit 372d4c6d7b
1 changed files with 8 additions and 10 deletions

View File

@ -529,20 +529,18 @@ class EventsStore(SQLBaseStore):
logger.debug("do_fetch got events: %r", row_dict.keys())
def fire(evs):
for ids, d in evs:
def fire(lst, res):
for ids, d in lst:
if not d.called:
try:
d.callback(
[
row_dict[i]
for i in ids
if i in row_dict
]
)
d.callback([
res[i]
for i in ids
if i in res
])
except:
logger.exception("Failed to callback")
reactor.callFromThread(fire, event_list)
reactor.callFromThread(fire, event_list, row_dict)
except Exception as e:
logger.exception("do_fetch")