summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
Diffstat (limited to 'synapse')
-rw-r--r--synapse/api/events/__init__.py1
-rw-r--r--synapse/federation/replication.py5
2 files changed, 4 insertions, 2 deletions
diff --git a/synapse/api/events/__init__.py b/synapse/api/events/__init__.py
index 72c493db57..add81ec3e6 100644
--- a/synapse/api/events/__init__.py
+++ b/synapse/api/events/__init__.py
@@ -25,6 +25,7 @@ def serialize_event(hs, e):
     d = e.get_dict()
     if "age_ts" in d:
         d["age"] = int(hs.get_clock().time_msec()) - d["age_ts"]
+        del d["age_ts"]
 
     return d
 
diff --git a/synapse/federation/replication.py b/synapse/federation/replication.py
index a48a7ac15f..96b82f00cb 100644
--- a/synapse/federation/replication.py
+++ b/synapse/federation/replication.py
@@ -292,8 +292,9 @@ class ReplicationLayer(object):
         transaction = Transaction(**transaction_data)
 
         for p in transaction.pdus:
-            if "age_ts" in p:
-                p["age"] = int(self._clock.time_msec()) - int(p["age_ts"])
+            if "age" in p:
+                p["age_ts"] = int(self._clock.time_msec()) - int(p["age"])
+                del p["age"]
 
         pdu_list = [Pdu(**p) for p in transaction.pdus]