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

Port the PresenceRouter module interface to the new generic interface #10524

Merged
Prev Previous commit
Next Next commit
Added error handling when calling callbacks
Also renamed the callback types to the form
of XYZ_CALLBACK
  • Loading branch information
Azrenbeth authored and Azrenbeth committed Aug 11, 2021
commit 8fb5363436d515ebaf3d62d3fdabea0d935a475c
5 changes: 4 additions & 1 deletion synapse/events/presence_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# 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.
import logging
from typing import (
TYPE_CHECKING,
Awaitable,
Expand All @@ -27,13 +28,15 @@
from synapse.util.async_helpers import maybe_awaitable

if TYPE_CHECKING:
from synapse.server import HomeServer, logger
from synapse.server import HomeServer

GET_USERS_FOR_STATES_CALLBACK = Callable[
[Iterable[UserPresenceState]], Awaitable[Dict[str, Set[UserPresenceState]]]
]
GET_INTERESTED_USERS_CALLBACK = Callable[[str], Awaitable[Union[Set[str], str]]]

logger = logging.getLogger(__name__)


def load_legacy_presence_router(hs: "HomeServer"):
"""Wrapper that loads a presence router module configured using the old
Expand Down