Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 38cf09d

Browse files
committed
Add assertion during ReplicationEndpoint construction
1 parent 4d74a65 commit 38cf09d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

synapse/replication/http/_base.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import abc
1717
import logging
1818
import re
19+
from inspect import signature
1920
from typing import Dict, List, Tuple
2021

2122
from six import raise_from
@@ -93,6 +94,16 @@ def __init__(self, hs):
9394
hs, "repl." + self.NAME, timeout_ms=30 * 60 * 1000
9495
)
9596

97+
# We reserve `instance_name` as a parameter to sending requests, so we
98+
# assert here that sub classes don't try and use the name.
99+
assert (
100+
"instance_name" not in self.PATH_ARGS
101+
), "`instance_name` is a reserved paramater name"
102+
assert (
103+
"instance_name"
104+
not in signature(self.__class__._serialize_payload).parameters
105+
), "`instance_name` is a reserved paramater name"
106+
96107
assert self.METHOD in ("PUT", "POST", "GET")
97108

98109
@abc.abstractmethod

0 commit comments

Comments
 (0)