Err, don't use global

This commit is contained in:
Erik Johnston 2015-06-01 14:03:29 +01:00
parent 878f5b0cf7
commit 06d1ec5dbc

View file

@ -521,21 +521,20 @@ class SynapseSite(Site):
def run(hs):
def prof(f):
from synapse.handlers.room import total_time
import synapse.handlers.room
import time
def g(*args, **kwargs):
global total_time
total_time = 0
start = int(time.time()*1000)
f(*args, **kwargs)
end = int(time.time()*1000)
if end - start > 50:
if synapse.handlers.room.total_time > 50:
logger.info(
"Total time in get_room_members: %d ms / %d ms",
int(total_time*1000),
end - start
)
synapse.handlers.room.total_time = 0
return g
reactor.runUntilCurrent = prof(reactor.runUntilCurrent)