Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit c1482a3

Browse files
authored
Fix returned count of delete extremities admin API (#12496)
1 parent b80bb7e commit c1482a3

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

changelog.d/12496.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix bug where the admin API for [deleting forward extremities](https://github.com/matrix-org/synapse/blob/erikj/fix_delete_event_response_count/docs/admin_api/rooms.md#deleting-forward-extremities) would always return a count of 1 no matter how many extremities were deleted. Broke in v1.27.0.

synapse/storage/databases/main/events_forward_extremities.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,23 @@ def delete_forward_extremities_for_room_txn(txn: LoggingTransaction) -> int:
6666
"""
6767

6868
txn.execute(sql, (event_id, room_id))
69+
70+
deleted_count = txn.rowcount
6971
logger.info(
7072
"Deleted %s extra forward extremities for room %s",
71-
txn.rowcount,
73+
deleted_count,
7274
room_id,
7375
)
7476

75-
if txn.rowcount > 0:
77+
if deleted_count > 0:
7678
# Invalidate the cache
7779
self._invalidate_cache_and_stream(
7880
txn,
7981
self.get_latest_event_ids_in_room,
8082
(room_id,),
8183
)
8284

83-
return txn.rowcount
85+
return deleted_count
8486

8587
return await self.db_pool.runInteraction(
8688
"delete_forward_extremities_for_room",

0 commit comments

Comments
 (0)