From ea783550bb8098f7c37e6ebfa83902108f377890 Mon Sep 17 00:00:00 2001
From: Will Hunt <will@half-shot.uk>
Date: Tue, 5 Dec 2023 11:40:27 +0000
Subject: [PATCH] Set response values to zero if None for
 /_synapse/admin/v1/federation/destinations (#16729)

---
 changelog.d/16729.bugfix         | 1 +
 synapse/rest/admin/federation.py | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
 create mode 100644 changelog.d/16729.bugfix

diff --git a/changelog.d/16729.bugfix b/changelog.d/16729.bugfix
new file mode 100644
index 0000000000..50e72ac1f8
--- /dev/null
+++ b/changelog.d/16729.bugfix
@@ -0,0 +1 @@
+Fix GET /_synapse/admin/v1/federation/destinations returning null (instead of 0) for `retry_last_ts` and `retry_interval`.
diff --git a/synapse/rest/admin/federation.py b/synapse/rest/admin/federation.py
index a6ce787da1..2f238f0217 100644
--- a/synapse/rest/admin/federation.py
+++ b/synapse/rest/admin/federation.py
@@ -89,8 +89,8 @@ class ListDestinationsRestServlet(RestServlet):
             "destinations": [
                 {
                     "destination": r[0],
-                    "retry_last_ts": r[1],
-                    "retry_interval": r[2],
+                    "retry_last_ts": r[1] or 0,
+                    "retry_interval": r[2] or 0,
                     "failure_ts": r[3],
                     "last_successful_stream_ordering": r[4],
                 }
-- 
GitLab