summary refs log tree commit diff
path: root/tests/util/caches
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-08-12 15:39:14 +0100
committerErik Johnston <erik@matrix.org>2019-08-13 16:20:38 +0100
commit17e1e807264ce13774d9b343c96406795ea24c27 (patch)
treeae21442fa71066b889a5cc2d83da95a699146590 /tests/util/caches
parentDon't load the media repo when configured to use an external media repo (#5754) (diff)
downloadsynapse-17e1e807264ce13774d9b343c96406795ea24c27.tar.xz
Retry well-known lookup before expiry.
This gives a bit of a grace period where we can attempt to refetch a
remote `well-known`, while still using the cached result if that fails.

Hopefully this will make the well-known resolution a bit more torelant
of failures, rather than it immediately treating failures as "no result"
and caching that for an hour.
Diffstat (limited to 'tests/util/caches')
-rw-r--r--tests/util/caches/test_ttlcache.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/util/caches/test_ttlcache.py b/tests/util/caches/test_ttlcache.py
index c94cbb662b..816795c136 100644
--- a/tests/util/caches/test_ttlcache.py
+++ b/tests/util/caches/test_ttlcache.py
@@ -36,7 +36,7 @@ class CacheTestCase(unittest.TestCase):
         self.assertTrue("one" in self.cache)
         self.assertEqual(self.cache.get("one"), "1")
         self.assertEqual(self.cache["one"], "1")
-        self.assertEqual(self.cache.get_with_expiry("one"), ("1", 110))
+        self.assertEqual(self.cache.get_with_expiry("one"), ("1", 110, 10))
         self.assertEqual(self.cache._metrics.hits, 3)
         self.assertEqual(self.cache._metrics.misses, 0)
 
@@ -77,7 +77,7 @@ class CacheTestCase(unittest.TestCase):
         self.assertEqual(self.cache["two"], "2")
         self.assertEqual(self.cache["three"], "3")
 
-        self.assertEqual(self.cache.get_with_expiry("two"), ("2", 120))
+        self.assertEqual(self.cache.get_with_expiry("two"), ("2", 120, 20))
 
         self.assertEqual(self.cache._metrics.hits, 5)
         self.assertEqual(self.cache._metrics.misses, 0)