summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-12-21 11:47:45 +0000
committerErik Johnston <erik@matrix.org>2014-12-21 11:47:45 +0000
commit74ee4048c2b0cb2fa7fb1e80027de37979b5dd86 (patch)
treeacd6ec851f1b951f87f6c5360bbe6d2b358be64a
parentMerge branch 'hotfixes-v0.6.0' of github.com:matrix-org/synapse into erikj-perf (diff)
parentMerge branch 'hotfixes-v0.6.0' (diff)
downloadsynapse-74ee4048c2b0cb2fa7fb1e80027de37979b5dd86.tar.xz
Merge branch 'master' of github.com:matrix-org/synapse into erikj-perf
-rw-r--r--CHANGES.rst6
-rw-r--r--synapse/handlers/profile.py6
-rw-r--r--tests/handlers/test_presencelike.py11
-rw-r--r--tests/handlers/test_profile.py9
4 files changed, 26 insertions, 6 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index 23bdac6a8a..813ad364ea 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -2,6 +2,12 @@ Changes in synapse 0.6.0 (2014-12-16)
 =====================================
 
  * Add new API for media upload and download that supports thumbnailing.
+ * Replicate media uploads over multiple homeservers so media is always served
+   to clients from their local homeserver.  This obsoletes the
+   --content-addr parameter and confusion over accessing content directly
+   from remote homeservers.
+ * Implement exponential backoff when retrying federation requests when
+   sending to remote homeservers which are offline.
  * Implement typing notifications.
  * Fix bugs where we sent events with invalid signatures due to bugs where
    we incorrectly persisted events.
diff --git a/synapse/handlers/profile.py b/synapse/handlers/profile.py
index 33a2c167ec..3f11e2dcf4 100644
--- a/synapse/handlers/profile.py
+++ b/synapse/handlers/profile.py
@@ -194,6 +194,8 @@ class ProfileHandler(BaseHandler):
         if not self.hs.is_mine(user):
             return
 
+        self.ratelimit(user.to_string())
+
         joins = yield self.store.get_rooms_for_user_where_membership_is(
             user.to_string(),
             [Membership.JOIN],
@@ -214,5 +216,5 @@ class ProfileHandler(BaseHandler):
                 "room_id": j.room_id,
                 "state_key": j.state_key,
                 "content": content,
-                "sender": j.state_key,
-            })
+                "sender": j.state_key
+            }, ratelimit=False)
diff --git a/tests/handlers/test_presencelike.py b/tests/handlers/test_presencelike.py
index 532ecf0f2c..0584e4c8b9 100644
--- a/tests/handlers/test_presencelike.py
+++ b/tests/handlers/test_presencelike.py
@@ -19,7 +19,7 @@ presence and profiles; namely, the displayname and avatar_url."""
 from tests import unittest
 from twisted.internet import defer
 
-from mock import Mock, call, ANY
+from mock import Mock, call, ANY, NonCallableMock
 
 from ..utils import MockClock, MockKey
 
@@ -75,8 +75,13 @@ class PresenceProfilelikeDataTestCase(unittest.TestCase):
                 resource_for_federation=Mock(),
                 http_client=None,
                 replication_layer=MockReplication(),
-                config=self.mock_config,
-            )
+                ratelimiter=NonCallableMock(spec_set=[
+                "send_message",
+                ]),
+                config=self.mock_config
+        )
+        self.ratelimiter = hs.get_ratelimiter()
+        self.ratelimiter.send_message.return_value = (True, 0)
         hs.handlers = PresenceAndProfileHandlers(hs)
 
         self.datastore = hs.get_datastore()
diff --git a/tests/handlers/test_profile.py b/tests/handlers/test_profile.py
index 1660e7e928..25b172aa5e 100644
--- a/tests/handlers/test_profile.py
+++ b/tests/handlers/test_profile.py
@@ -17,7 +17,7 @@
 from tests import unittest
 from twisted.internet import defer
 
-from mock import Mock
+from mock import Mock, NonCallableMock
 
 from synapse.api.errors import AuthError
 from synapse.server import HomeServer
@@ -59,7 +59,14 @@ class ProfileTestCase(unittest.TestCase):
                 resource_for_federation=Mock(),
                 replication_layer=self.mock_federation,
                 config=self.mock_config,
+                ratelimiter=NonCallableMock(spec_set=[
+                    "send_message",
+                ])
             )
+
+        self.ratelimiter = hs.get_ratelimiter()
+        self.ratelimiter.send_message.return_value = (True, 0)
+
         hs.handlers = ProfileHandlers(hs)
 
         self.store = hs.get_datastore()