Example #1
0
    def __init__(self, db_conn, hs):
        super(RoomMemberWorkerStore, self).__init__(db_conn, hs)

        # Is the current_state_events.membership up to date? Or is the
        # background update still running?
        self._current_state_events_membership_up_to_date = False

        txn = LoggingTransaction(
            db_conn.cursor(),
            name="_check_safe_current_state_events_membership_updated",
            database_engine=self.database_engine,
        )
        self._check_safe_current_state_events_membership_updated_txn(txn)
        txn.close()

        if self.hs.config.metrics_flags.known_servers:
            self._known_servers_count = 1
            self.hs.get_clock().looping_call(
                run_as_background_process,
                60 * 1000,
                "_count_known_servers",
                self._count_known_servers,
            )
            self.hs.get_clock().call_later(
                1000,
                run_as_background_process,
                "_count_known_servers",
                self._count_known_servers,
            )
            LaterGauge(
                "synapse_federation_known_servers",
                "",
                [],
                lambda: self._known_servers_count,
            )
Example #2
0
    def __init__(self, db_conn, hs):
        super(RoomMemberWorkerStore, self).__init__(db_conn, hs)

        # Is the current_state_events.membership up to date? Or is the
        # background update still running?
        self._current_state_events_membership_up_to_date = False

        txn = LoggingTransaction(
            db_conn.cursor(),
            name="_check_safe_current_state_events_membership_updated",
            database_engine=self.database_engine,
        )
        self._check_safe_current_state_events_membership_updated_txn(txn)
        txn.close()
Example #3
0
    def __init__(self, db_conn, hs):
        super(EventPushActionsWorkerStore, self).__init__(db_conn, hs)

        # These get correctly set by _find_stream_orderings_for_times_txn
        self.stream_ordering_month_ago = None
        self.stream_ordering_day_ago = None

        cur = LoggingTransaction(
            db_conn.cursor(),
            name="_find_stream_orderings_for_times_txn",
            database_engine=self.database_engine,
        )
        self._find_stream_orderings_for_times_txn(cur)
        cur.close()

        self.find_stream_orderings_looping_call = self._clock.looping_call(
            self._find_stream_orderings_for_times, 10 * 60 * 1000)
        self._rotate_delay = 3
        self._rotate_count = 10000
Example #4
0
    def __init__(self, db_conn, hs):
        super(EventPushActionsWorkerStore, self).__init__(db_conn, hs)

        # These get correctly set by _find_stream_orderings_for_times_txn
        self.stream_ordering_month_ago = None
        self.stream_ordering_day_ago = None

        cur = LoggingTransaction(
            db_conn.cursor(),
            name="_find_stream_orderings_for_times_txn",
            database_engine=self.database_engine,
            after_callbacks=[],
            exception_callbacks=[],
        )
        self._find_stream_orderings_for_times_txn(cur)
        cur.close()

        self.find_stream_orderings_looping_call = self._clock.looping_call(
            self._find_stream_orderings_for_times, 10 * 60 * 1000
        )