mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 21:54:53 -04:00
Add some type hints to datastore (#12717)
This commit is contained in:
parent
942c30b16b
commit
6edefef602
10 changed files with 254 additions and 161 deletions
|
@ -15,7 +15,17 @@
|
|||
import abc
|
||||
import logging
|
||||
from collections import OrderedDict
|
||||
from typing import TYPE_CHECKING, Dict, Hashable, Iterable, List, Optional, Set, Tuple
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Collection,
|
||||
Dict,
|
||||
Hashable,
|
||||
Iterable,
|
||||
List,
|
||||
Optional,
|
||||
Set,
|
||||
Tuple,
|
||||
)
|
||||
|
||||
import attr
|
||||
from prometheus_client import Counter
|
||||
|
@ -409,7 +419,7 @@ class FederationSender(AbstractFederationSender):
|
|||
)
|
||||
return
|
||||
|
||||
destinations: Optional[Set[str]] = None
|
||||
destinations: Optional[Collection[str]] = None
|
||||
if not event.prev_event_ids():
|
||||
# If there are no prev event IDs then the state is empty
|
||||
# and so no remote servers in the room
|
||||
|
@ -444,7 +454,7 @@ class FederationSender(AbstractFederationSender):
|
|||
)
|
||||
return
|
||||
|
||||
destinations = {
|
||||
sharded_destinations = {
|
||||
d
|
||||
for d in destinations
|
||||
if self._federation_shard_config.should_handle(
|
||||
|
@ -456,12 +466,12 @@ class FederationSender(AbstractFederationSender):
|
|||
# If we are sending the event on behalf of another server
|
||||
# then it already has the event and there is no reason to
|
||||
# send the event to it.
|
||||
destinations.discard(send_on_behalf_of)
|
||||
sharded_destinations.discard(send_on_behalf_of)
|
||||
|
||||
logger.debug("Sending %s to %r", event, destinations)
|
||||
logger.debug("Sending %s to %r", event, sharded_destinations)
|
||||
|
||||
if destinations:
|
||||
await self._send_pdu(event, destinations)
|
||||
if sharded_destinations:
|
||||
await self._send_pdu(event, sharded_destinations)
|
||||
|
||||
now = self.clock.time_msec()
|
||||
ts = await self.store.get_received_ts(event.event_id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue