Module ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias Import alias Import alias Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Dict Expr Call AttributeLoad NameLoad attr Str Lambda arguments args defaults Call NameLoad AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameStore Dict Assign AttributeStore NameLoad attr NameStore Dict Expr Call AttributeLoad NameLoad attr Str Lambda arguments args defaults Call NameLoad Call NameLoad NameLoad Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Lambda arguments args defaults Call NameLoad Call NameLoad NameLoad Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Dict Assign AttributeStore NameLoad attr Call NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If CompareEq NameLoad AttributeLoad NameLoad attr body Return NameLoad If Call AttributeLoad AttributeLoad NameLoad attr attr Str body Return Call AttributeLoad NameLoad attr Str orelse Return UnaryOpNot Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad GeneratorExp NameLoad comprehension NameStore NameLoad Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad If UnaryOpNot NameLoad body Return Assign NameStore ListLoad For NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad ListLoad attr TupleLoad NameLoad NameLoad NameLoad FunctionDef arguments args NameParam defaults body If UnaryOpNot AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Str NameLoad AttributeLoad NameLoad attr decorator_list Expr Call AttributeLoad NameLoad attr NameLoad With Call NameLoad body Expr Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore AttributeLoad NameLoad attr If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad body Return Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad ListLoad attr TupleLoad NameLoad NameLoad FunctionDef arguments args NameParam defaults body If UnaryOpNot AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Str NameLoad AttributeLoad NameLoad attr decorator_list Expr Call AttributeLoad NameLoad attr NameLoad With Call NameLoad body Expr Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body If BoolOpOr CompareEq NameLoad AttributeLoad NameLoad attr CompareEq NameLoad Str body Return Assign NameStore Call AttributeLoad NameLoad attr If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad body Return Expr Call AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad ListLoad attr TupleLoad NameLoad NameLoad FunctionDef arguments args NameParam defaults body If UnaryOpNot AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Str NameLoad AttributeLoad NameLoad attr decorator_list Expr Call AttributeLoad NameLoad attr NameLoad With Call NameLoad body Expr Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr NameLoad Expr Yield NameLoad decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam NameParam defaults body If CompareIn NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str NameLoad Return Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad ListLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad ListLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad ListLoad If NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad Call NameLoad NameLoad If BoolOpAnd UnaryOpNot NameLoad UnaryOpNot NameLoad UnaryOpNot NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad Return TryFinally body TryExcept body Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad Num Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad NameLoad attr keyword Lambda arguments args NameParam defaults SubscriptLoad NameLoad Index Num Assign NameStore ListComp SubscriptLoad NameLoad Index Num comprehension NameStore NameLoad Assign NameStore ListComp SubscriptLoad NameLoad Index Num comprehension NameStore NameLoad Assign NameStore ListComp Call AttributeLoad SubscriptLoad NameLoad Index Num attr comprehension NameStore NameLoad Assign NameStore ListComp SubscriptLoad NameLoad Index Num comprehension NameStore BinOpAdd BinOpAdd NameLoad NameLoad NameLoad Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign NameStore Yield Call NameLoad NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str NameLoad NameLoad Call NameLoad NameLoad Call NameLoad NameLoad Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr keyword Call NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad keyword AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad AugAssignAdd AttributeStore NameLoad attr Num Expr Yield Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad NameLoad AttributeLoad NameLoad attr Call NameLoad NameLoad Call NameLoad NameLoad Call NameLoad NameLoad With NameLoad body FunctionDef arguments args defaults body Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr If CompareIn Str NameLoad body For NameStore SubscriptLoad NameLoad Index Str body If CompareIn Str NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str Dict Assign SubscriptStore NameLoad Index Str BinOpSub NameLoad Call NameLoad SubscriptLoad NameLoad Index Str Delete SubscriptDel NameLoad Index Str Return NameLoad decorator_list TryExcept body Assign NameStore Yield Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Assign NameStore Num If NameLoad body For TupleStore NameStore NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Str Dict attr body If CompareIn Str NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad NameLoad handlers ExceptHandler type NameLoad name NameStore body Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Yield Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad For NameStore NameLoad body If CompareEq NameLoad Num body Expr Call AttributeLoad NameLoad attr NameLoad orelse Expr Call AttributeLoad NameLoad attr Call NameLoad BinOpMod Str NameLoad TryExcept body Expr Yield NameLoad handlers ExceptHandler body Pass Expr Call AttributeLoad NameLoad attr Str NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad ExceptHandler type NameLoad name NameStore body Expr Call AttributeLoad NameLoad attr Str NameLoad NameLoad ExceptHandler type NameLoad name NameStore body Expr Call AttributeLoad NameLoad attr Str NameLoad NameLoad For NameStore NameLoad body If UnaryOpNot AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad finalbody Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list AttributeLoad NameLoad attr NameLoad decorator_list
N/A twisted.internet defer persistence TransactionActions units Transaction synapse.api.errors HttpResponseException synapse.util.logutils log_function synapse.util.logcontext PreserveLoggingContext synapse.util.retryutils get_retry_limiter NotRetryingDestination N/A synapse.metrics N/A logging N/A logger N/A N/A logging getLogger __name__ N/A metrics N/A N/A N/A synapse metrics get_metrics_for __name__ TransactionQueue N/A object N/A N/A This class makes sure we only have one transaction in flight at
    a time for a given destination.

    It batches pending PDUs into single transactions.
     __init__ N/A N/A self hs transport_layer N/A N/A N/A N/A self server_name N/A hs hostname N/A N/A self store N/A N/A hs get_datastore N/A N/A self transaction_actions N/A TransactionActions N/A self store N/A N/A self transport_layer transport_layer N/A N/A self _clock N/A N/A hs get_clock N/A N/A self pending_transactions N/A N/A N/A N/A metrics register_callback pending_destinations N/A N/A N/A N/A N/A len N/A self pending_transactions N/A N/A self pending_pdus_by_dest pdus N/A N/A N/A self pending_edus_by_dest edus N/A N/A N/A N/A metrics register_callback pending_pdus N/A N/A N/A N/A N/A sum N/A map len N/A N/A pdus values N/A N/A N/A metrics register_callback pending_edus N/A N/A N/A N/A N/A sum N/A map len N/A N/A edus values N/A N/A self pending_failures_by_dest N/A N/A N/A self _next_txn_id N/A int N/A N/A N/A self _clock time_msec N/A can_send_to N/A N/A self destination N/A N/A N/A Can we send messages to the given server?

        We can't send messages to ourselves. If we are running on localhost
        then we can only federation with other servers running on localhost.
        Otherwise we only federate with servers on a public domain.

        Args:
            destination(str): The server we are possibly trying to send to.
        Returns:
            bool: True if we can send to the server.
         N/A N/A destination N/A self server_name N/A N/A False N/A N/A N/A N/A self server_name startswith localhost N/A N/A N/A N/A destination startswith localhost N/A N/A N/A N/A N/A destination startswith localhost N/A enqueue_pdu N/A N/A self pdu destinations order N/A N/A N/A destinations N/A set destinations N/A destinations N/A set N/A dest N/A dest destinations N/A N/A self can_send_to dest N/A N/A N/A logger debug Sending to: %s N/A str destinations N/A N/A destinations N/A N/A N/A deferreds N/A N/A destination destinations N/A N/A deferred N/A N/A defer Deferred N/A N/A N/A N/A N/A N/A self pending_pdus_by_dest setdefault destination N/A append N/A pdu deferred order chain N/A N/A failure N/A N/A N/A N/A N/A deferred called N/A N/A N/A N/A deferred errback failure N/A log_failure N/A N/A f N/A N/A N/A N/A N/A logger warn Failed to send pdu to %s: %s destination N/A f value N/A N/A N/A N/A deferred addErrback log_failure N/A N/A PreserveLoggingContext N/A N/A N/A N/A N/A N/A self _attempt_new_transaction destination addErrback chain N/A N/A N/A deferreds append deferred N/A enqueue_edu N/A N/A self edu N/A N/A N/A destination N/A edu destination N/A N/A N/A N/A self can_send_to destination N/A N/A N/A deferred N/A N/A defer Deferred N/A N/A N/A N/A N/A N/A self pending_edus_by_dest setdefault destination N/A append N/A edu deferred chain N/A N/A failure N/A N/A N/A N/A N/A deferred called N/A N/A N/A N/A deferred errback failure N/A log_failure N/A N/A f N/A N/A N/A N/A N/A logger warn Failed to send edu to %s: %s destination N/A f value N/A N/A N/A N/A deferred addErrback log_failure N/A N/A PreserveLoggingContext N/A N/A N/A N/A N/A N/A self _attempt_new_transaction destination addErrback chain N/A deferred N/A enqueue_failure N/A N/A self failure destination N/A N/A N/A N/A N/A destination N/A self server_name N/A destination localhost N/A N/A N/A deferred N/A N/A defer Deferred N/A N/A N/A N/A self can_send_to destination N/A N/A N/A N/A N/A N/A N/A N/A self pending_failures_by_dest setdefault destination N/A append N/A failure deferred chain N/A N/A f N/A N/A N/A N/A N/A deferred called N/A N/A N/A N/A deferred errback f N/A log_failure N/A N/A f N/A N/A N/A N/A N/A logger warn Failed to send failure to %s: %s destination N/A f value N/A N/A N/A N/A deferred addErrback log_failure N/A N/A PreserveLoggingContext N/A N/A N/A N/A N/A N/A self _attempt_new_transaction destination addErrback chain N/A N/A deferred N/A N/A defer inlineCallbacks _attempt_new_transaction N/A N/A self destination N/A N/A N/A N/A destination N/A self pending_transactions N/A N/A N/A N/A logger debug TX [%s] Transaction already in progress destination N/A N/A pending_pdus N/A N/A N/A self pending_pdus_by_dest pop destination N/A N/A pending_edus N/A N/A N/A self pending_edus_by_dest pop destination N/A N/A pending_failures N/A N/A N/A self pending_failures_by_dest pop destination N/A N/A pending_pdus N/A N/A N/A N/A logger debug TX [%s] len(pending_pdus_by_dest[dest]) = %d destination N/A len pending_pdus N/A N/A N/A pending_pdus N/A pending_edus N/A pending_failures N/A N/A N/A N/A logger debug TX [%s] Nothing to send destination N/A N/A N/A N/A N/A N/A N/A N/A self pending_transactions N/A destination 1 N/A N/A N/A logger debug TX [%s] _attempt_new_transaction destination N/A N/A N/A pending_pdus sort key N/A N/A N/A t N/A N/A t N/A 2 N/A pdus N/A N/A x N/A 0 N/A x pending_pdus N/A edus N/A N/A x N/A 0 N/A x pending_edus N/A failures N/A N/A N/A N/A x N/A 0 get_dict N/A x pending_failures N/A deferreds N/A N/A x N/A 1 N/A x N/A N/A pending_pdus pending_edus pending_failures N/A txn_id N/A str N/A self _next_txn_id N/A limiter N/A N/A get_retry_limiter destination N/A self _clock N/A self store N/A N/A N/A logger debug TX [%s] {%s} Attempting new transaction (pdus: %d, edus: %d, failures: %d) destination txn_id N/A len pending_pdus N/A len pending_edus N/A len pending_failures N/A N/A N/A logger debug TX [%s] Persisting transaction... destination N/A transaction N/A N/A Transaction create_new origin_server_ts N/A int N/A N/A N/A self _clock time_msec transaction_id txn_id origin N/A self server_name destination destination pdus pdus edus edus pdu_failures failures N/A N/A self _next_txn_id 1 N/A N/A N/A N/A N/A self transaction_actions prepare_to_send transaction N/A N/A N/A logger debug TX [%s] Persisted transaction destination N/A N/A N/A logger info TX [%s] {%s} Sending transaction [%s], (PDUs: %d, EDUs: %d, failures: %d) destination txn_id N/A transaction transaction_id N/A len pending_pdus N/A len pending_edus N/A len pending_failures N/A limiter N/A json_data_cb N/A N/A N/A N/A N/A data N/A N/A transaction get_dict N/A now N/A int N/A N/A N/A self _clock time_msec N/A N/A pdus data N/A N/A p N/A data N/A pdus N/A N/A N/A age_ts p N/A N/A unsigned N/A N/A p setdefault unsigned N/A N/A N/A unsigned N/A age N/A now N/A int N/A p N/A age_ts N/A N/A p N/A age_ts N/A data N/A N/A N/A N/A response N/A N/A N/A N/A self transport_layer send_transaction transaction json_data_cb N/A code 200 N/A response N/A N/A N/A e_id r N/A N/A N/A N/A response get pdus N/A items N/A N/A N/A error r N/A N/A N/A N/A logger warn Transaction returned error for %s: %s e_id r N/A N/A N/A HttpResponseException N/A e N/A N/A code N/A e code N/A response N/A e response N/A N/A N/A logger info TX [%s] {%s} got %d response destination txn_id code N/A N/A N/A logger debug TX [%s] Sent transaction destination N/A N/A N/A logger debug TX [%s] Marking as delivered... destination N/A N/A N/A N/A N/A self transaction_actions delivered transaction code response N/A N/A N/A logger debug TX [%s] Marked as delivered destination N/A N/A N/A logger debug TX [%s] Yielding to callbacks... destination N/A deferred deferreds N/A N/A N/A code 200 N/A N/A N/A N/A deferred callback None N/A N/A N/A N/A deferred errback N/A RuntimeError N/A Got status %d code N/A N/A N/A N/A deferred N/A N/A N/A N/A N/A N/A N/A logger debug TX [%s] Yielded to callbacks destination N/A N/A N/A NotRetryingDestination N/A N/A N/A N/A logger info TX [%s] not ready for retry yet - dropping transaction for now destination N/A N/A RuntimeError N/A e N/A N/A N/A N/A logger warn TX [%s] Problem in _attempt_transaction: %s destination e N/A N/A Exception N/A e N/A N/A N/A N/A logger warn TX [%s] Problem in _attempt_transaction: %s destination e N/A deferred deferreds N/A N/A N/A N/A deferred called N/A N/A N/A N/A deferred errback e N/A N/A N/A N/A N/A self pending_transactions pop destination None N/A N/A N/A self _attempt_new_transaction destination N/A N/A defer inlineCallbacks log_function N/A