@wrap_as_background_process('on_new_notifications')
async def _on_new_notifications(self, max_token: RoomStreamToken) -> None:
    max_stream_id = max_token.stream
    prev_stream_id = self._last_room_stream_id_seen
    self._last_room_stream_id_seen = max_stream_id
    try:
        users_affected = (await self.store.get_push_action_users_in_range(prev_stream_id, max_stream_id))
        for u in users_affected:
            expired = (await self._account_validity_handler.is_user_expired(u))
            if expired:
                continue
            if (u in self.pushers):
                for p in self.pushers[u].values():
                    p.on_new_notifications(max_token)
    except Exception:
        logger.exception('Exception in pusher on_new_notifications')
@wrap_as_background_process('on_new_notifications')
async def _on_new_notifications(self, max_token: RoomStreamToken) -> None:
    max_stream_id = max_token.stream
    prev_stream_id = self._last_room_stream_id_seen
    self._last_room_stream_id_seen = max_stream_id
    try:
        users_affected = (await self.store.get_push_action_users_in_range(prev_stream_id, max_stream_id))
        for u in users_affected:
            expired = (await self._account_validity_handler.is_user_expired(u))
            if expired:
                continue
            if (u in self.pushers):
                for p in self.pushers[u].values():
                    p.on_new_notifications(max_token)
    except Exception:
        logger.exception('Exception in pusher on_new_notifications')