mirror of
https://github.com/element-hq/synapse
synced 2024-10-02 12:42:41 +00:00
Time get_room_members
This commit is contained in:
parent
b579a8ea18
commit
878f5b0cf7
2 changed files with 30 additions and 1 deletions
|
@ -520,6 +520,26 @@ class SynapseSite(Site):
|
|||
|
||||
|
||||
def run(hs):
|
||||
def prof(f):
|
||||
from synapse.handlers.room import total_time
|
||||
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:
|
||||
logger.info(
|
||||
"Total time in get_room_members: %d ms / %d ms",
|
||||
int(total_time*1000),
|
||||
end - start
|
||||
)
|
||||
return g
|
||||
|
||||
reactor.runUntilCurrent = prof(reactor.runUntilCurrent)
|
||||
|
||||
PROFILE_SYNAPSE = False
|
||||
if PROFILE_SYNAPSE:
|
||||
def profile(func):
|
||||
|
|
|
@ -236,6 +236,8 @@ class RoomCreationHandler(BaseHandler):
|
|||
join_rules_event,
|
||||
]
|
||||
|
||||
import time
|
||||
total_time = 0
|
||||
|
||||
class RoomMemberHandler(BaseHandler):
|
||||
# TODO(paul): This handler currently contains a messy conflation of
|
||||
|
@ -256,7 +258,14 @@ class RoomMemberHandler(BaseHandler):
|
|||
def get_room_members(self, room_id):
|
||||
users = yield self.store.get_users_in_room(room_id)
|
||||
|
||||
defer.returnValue([UserID.from_string(u) for u in users])
|
||||
start = time.time()
|
||||
users = [UserID.from_string(u) for u in users]
|
||||
end = time.time()
|
||||
|
||||
global total_time
|
||||
total_time += end-start
|
||||
|
||||
defer.returnValue(users)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def fetch_room_distributions_into(self, room_id, localusers=None,
|
||||
|
|
Loading…
Reference in a new issue