Merge branch 'develop' of github.com:matrix-org/synapse into federation_client_retries

This commit is contained in:
Erik Johnston 2015-02-05 13:50:28 +00:00
commit 8f5b858a1b
3 changed files with 82 additions and 5 deletions

View File

@ -1,3 +1,8 @@
Changes in develop
==================
* pydenticon support -- adds dep on pydenticon
Changes in synapse 0.6.1 (2015-01-07) Changes in synapse 0.6.1 (2015-01-07)
===================================== =====================================

65
scripts/check_auth.py Normal file
View File

@ -0,0 +1,65 @@
from synapse.events import FrozenEvent
from synapse.api.auth import Auth
from mock import Mock
import argparse
import itertools
import json
import sys
def check_auth(auth, auth_chain, events):
auth_chain.sort(key=lambda e: e.depth)
auth_map = {
e.event_id: e
for e in auth_chain
}
create_events = {}
for e in auth_chain:
if e.type == "m.room.create":
create_events[e.room_id] = e
for e in itertools.chain(auth_chain, events):
auth_events_list = [auth_map[i] for i, _ in e.auth_events]
auth_events = {
(e.type, e.state_key): e
for e in auth_events_list
}
auth_events[("m.room.create", "")] = create_events[e.room_id]
try:
auth.check(e, auth_events=auth_events)
except Exception as ex:
print "Failed:", e.event_id, e.type, e.state_key
print "Auth_events:", auth_events
print ex
print json.dumps(e.get_dict(), sort_keys=True, indent=4)
# raise
print "Success:", e.event_id, e.type, e.state_key
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
'json',
nargs='?',
type=argparse.FileType('r'),
default=sys.stdin,
)
args = parser.parse_args()
js = json.load(args.json)
auth = Auth(Mock())
check_auth(
auth,
[FrozenEvent(d) for d in js["auth_chain"]],
[FrozenEvent(d) for d in js["pdus"]],
)

View File

@ -16,7 +16,7 @@
from twisted.internet import defer from twisted.internet import defer
from synapse.api.constants import EventTypes, Membership from synapse.api.constants import EventTypes, Membership
from synapse.api.errors import RoomError from synapse.api.errors import RoomError, SynapseError
from synapse.streams.config import PaginationConfig from synapse.streams.config import PaginationConfig
from synapse.events.utils import serialize_event from synapse.events.utils import serialize_event
from synapse.events.validator import EventValidator from synapse.events.validator import EventValidator
@ -372,7 +372,14 @@ class MessageHandler(BaseHandler):
as_event=True, as_event=True,
) )
presence.append(member_presence) presence.append(member_presence)
except Exception: except SynapseError as e:
if e.code == 404:
# FIXME: We are doing this as a warn since this gets hit a
# lot and spams the logs. Why is this happening?
logger.warn(
"Failed to get member presence of %r", m.user_id
)
else:
logger.exception( logger.exception(
"Failed to get member presence of %r", m.user_id "Failed to get member presence of %r", m.user_id
) )