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

Commit 7aba135

Browse files
committed
Changes from review.
1 parent 90860ad commit 7aba135

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

synapse/federation/federation_server.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717
import logging
18-
from typing import Any, Callable, Dict, List, Match, Optional, Tuple
18+
from typing import Any, Callable, Dict, List, Match, Optional, Tuple, Union
1919

2020
import six
2121
from six import iteritems
@@ -111,7 +111,7 @@ async def on_backfill_request(
111111
return 200, res
112112

113113
async def on_incoming_transaction(
114-
self, origin: str, transaction_data: Dict[str, Any]
114+
self, origin: str, transaction_data: JsonDict
115115
) -> Tuple[int, Dict[str, Any]]:
116116
# keep this as early as possible to make the calculated origin ts as
117117
# accurate as possible.
@@ -380,7 +380,9 @@ async def _on_context_state_request_compute(
380380
"auth_chain": [pdu.get_pdu_json() for pdu in auth_chain],
381381
}
382382

383-
async def on_pdu_request(self, origin: str, event_id: str) -> Tuple[int, str]:
383+
async def on_pdu_request(
384+
self, origin: str, event_id: str
385+
) -> Tuple[int, Union[JsonDict, str]]:
384386
pdu = await self.handler.get_persisted_pdu(origin, event_id)
385387

386388
if pdu:
@@ -509,7 +511,7 @@ async def on_query_user_devices(
509511

510512
@trace
511513
async def on_claim_client_keys(
512-
self, origin: str, content: Dict[str, Any]
514+
self, origin: str, content: JsonDict
513515
) -> Dict[str, Any]:
514516
query = []
515517
for user_id, device_keys in content.get("one_time_keys", {}).items():
@@ -577,9 +579,9 @@ async def on_get_missing_events(
577579
return {"events": [ev.get_pdu_json(time_now) for ev in missing_events]}
578580

579581
@log_function
580-
def on_openid_userinfo(self, token: str) -> Optional[str]:
582+
async def on_openid_userinfo(self, token: str) -> Optional[str]:
581583
ts_now_ms = self._clock.time_msec()
582-
return self.store.get_user_id_for_open_id_token(token, ts_now_ms)
584+
return await self.store.get_user_id_for_open_id_token(token, ts_now_ms)
583585

584586
def _transaction_from_pdus(self, pdu_list: List[EventBase]) -> Transaction:
585587
"""Returns a new Transaction containing the given PDUs suitable for

0 commit comments

Comments
 (0)