summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2021-04-15 16:36:36 +0100
committerAndrew Morgan <andrew@amorgan.xyz>2021-04-15 16:57:15 +0100
commitd7259230681731cbf65e5bd046769cce215fdf9e (patch)
treeb0ad70830c3cffd0dce0d27a7ffa2358bf620a4c
parentremove `HomeServer.get_config` (#9815) (diff)
downloadsynapse-d7259230681731cbf65e5bd046769cce215fdf9e.tar.xz
Add a util file for non API-specific constants, and move ONE_HOUR to it
(This constant is used in the next commit.)

So there's not much here right now, and perhaps this could fit better in
another file. Though I didn't see anything quite appropriate.
-rw-r--r--synapse/appservice/api.py3
-rw-r--r--synapse/util/constants.py15
2 files changed, 16 insertions, 2 deletions
diff --git a/synapse/appservice/api.py b/synapse/appservice/api.py
index fe04d7a672..57a073ac77 100644
--- a/synapse/appservice/api.py
+++ b/synapse/appservice/api.py
@@ -24,6 +24,7 @@ from synapse.events.utils import serialize_event
 from synapse.http.client import SimpleHttpClient
 from synapse.types import JsonDict, ThirdPartyInstanceID
 from synapse.util.caches.response_cache import ResponseCache
+from synapse.util.constants import HOUR_IN_MS
 
 if TYPE_CHECKING:
     from synapse.appservice import ApplicationService
@@ -46,8 +47,6 @@ sent_events_counter = Counter(
     "synapse_appservice_api_sent_events", "Number of events sent to the AS", ["service"]
 )
 
-HOUR_IN_MS = 60 * 60 * 1000
-
 
 APP_SERVICE_PREFIX = "/_matrix/app/unstable"
 
diff --git a/synapse/util/constants.py b/synapse/util/constants.py
new file mode 100644
index 0000000000..ece1941b06
--- /dev/null
+++ b/synapse/util/constants.py
@@ -0,0 +1,15 @@
+# Copyright 2021 The Matrix.org Foundation C.I.C.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+HOUR_IN_MS = 60 * 60 * 1000