From b9be6c5b5d2eba58d82c8f4d93dce4f4b49d42e5 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Thu, 22 Sep 2022 22:48:58 -0500 Subject: Raise exception so we don't run into this arg mismatch again --- synapse/util/caches/descriptors.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/synapse/util/caches/descriptors.py b/synapse/util/caches/descriptors.py index 3909f1caea..0391966462 100644 --- a/synapse/util/caches/descriptors.py +++ b/synapse/util/caches/descriptors.py @@ -431,6 +431,12 @@ class DeferredCacheListDescriptor(_CacheDescriptorBase): cache: DeferredCache[CacheKey, Any] = cached_method.cache num_args = cached_method.num_args + if num_args != self.num_args: + raise Exception( + "Number of args (%s) does not match underlying cache_method_name=%s (%s)." + % (self.num_args, self.cached_method_name, num_args) + ) + @functools.wraps(self.orig) def wrapped(*args: Any, **kwargs: Any) -> "defer.Deferred[Dict]": # If we're passed a cache_context then we'll want to call its -- cgit 1.5.1