mirror of
https://github.com/element-hq/synapse
synced 2024-10-01 06:22:40 +00:00
Err, don't use global
This commit is contained in:
parent
878f5b0cf7
commit
06d1ec5dbc
1 changed files with 3 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue