diff --git a/synapse/federation/transport/server/federation.py b/synapse/federation/transport/server/federation.py index 6bb4659c4c9e..6caea0ee6cfe 100644 --- a/synapse/federation/transport/server/federation.py +++ b/synapse/federation/transport/server/federation.py @@ -100,14 +100,32 @@ async def on_PUT( logger.debug("Decoded %s: %s", transaction_id, str(transaction_data)) + edus_before_filter = len(transaction_data.get("edus", [])) + + filtered_edus = [] + for edu in transaction_data.get("edus", []): + edu_type = edu.get('edu_type', 'io.t2bot.ignored') + if edu_type == 'io.t2bot.ignored': + continue + if edu_type == 'm.presence': + continue + if edu_type == 'm.receipt': + continue + if edu_type == 'm.typing': + continue + filtered_edus.append(edu) + logger.info( - "Received txn %s from %s. (PDUs: %d, EDUs: %d)", + "Received txn %s from %s. (PDUs: %d, Accepted EDUs: %d, Ignored EDUs: %d)", transaction_id, origin, len(transaction_data.get("pdus", [])), - len(transaction_data.get("edus", [])), + len(filtered_edus), + edus_before_filter - len(filtered_edus), ) + transaction_data["edus"] = filtered_edus + if issue_8631_logger.isEnabledFor(logging.DEBUG): DEVICE_UPDATE_EDUS = [ EduTypes.DEVICE_LIST_UPDATE,