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

Commit

Permalink
address review
Browse files Browse the repository at this point in the history
  • Loading branch information
Half-Shot committed Oct 15, 2020
1 parent a795b67 commit 1a9adfc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion synapse/appservice/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def get_groups_for_user(self, user_id: str) -> Iterable[str]:
user_id: The ID of the user.
Returns:
iterable: an iterable that yields group_id strings.
An iterable that yields group_id strings.
"""
return (
regex_obj["group_id"]
Expand Down
6 changes: 3 additions & 3 deletions synapse/appservice/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
components.
"""
import logging
from typing import List, Optional
from typing import List

from synapse.appservice import ApplicationService, ApplicationServiceState
from synapse.events import EventBase
Expand Down Expand Up @@ -120,7 +120,7 @@ def _start_background_request(self, service):
"as-sender-%s" % (service.id,), self._send_request, service
)

def enqueue_event(self, service, event):
def enqueue_event(self, service: ApplicationService, event: EventBase):
self.queued_events.setdefault(service.id, []).append(event)
self._start_background_request(service)

Expand Down Expand Up @@ -177,7 +177,7 @@ async def send(
self,
service: ApplicationService,
events: List[EventBase],
ephemeral: Optional[JsonDict] = None,
ephemeral: List[JsonDict] = [],
):
try:
txn = await self.store.create_appservice_txn(
Expand Down
14 changes: 13 additions & 1 deletion synapse/storage/databases/main/receipts.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from synapse.storage._base import SQLBaseStore, db_to_json, make_in_list_sql_clause
from synapse.storage.database import DatabasePool
from synapse.storage.util.id_generators import StreamIdGenerator
from synapse.types import JsonDict
from synapse.util import json_encoder
from synapse.util.async_helpers import ObservableDeferred
from synapse.util.caches.descriptors import cached, cachedList
Expand Down Expand Up @@ -277,7 +278,18 @@ def f(txn):
@cached(num_args=2,)
async def get_linearized_receipts_for_all_rooms(
self, to_key: int, from_key: Optional[int] = None
):
) -> Dict[str, JsonDict]:
"""Get receipts for all rooms between two stream_ids.
Args:
to_key: Max stream id to fetch receipts upto.
from_key: Min stream id to fetch receipts from. None fetches
from the start.
Returns:
A dictionary of roomids to a list of receipts.
"""

def f(txn):
if from_key:
sql = """
Expand Down

0 comments on commit 1a9adfc

Please sign in to comment.