Skip to content
Snippets Groups Projects
Unverified Commit c1482a35 authored by Erik Johnston's avatar Erik Johnston Committed by GitHub
Browse files

Fix returned count of delete extremities admin API (#12496)

parent b80bb7e4
No related branches found
No related tags found
No related merge requests found
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.
...@@ -66,13 +66,15 @@ class EventForwardExtremitiesStore( ...@@ -66,13 +66,15 @@ class EventForwardExtremitiesStore(
""" """
txn.execute(sql, (event_id, room_id)) txn.execute(sql, (event_id, room_id))
deleted_count = txn.rowcount
logger.info( logger.info(
"Deleted %s extra forward extremities for room %s", "Deleted %s extra forward extremities for room %s",
txn.rowcount, deleted_count,
room_id, room_id,
) )
if txn.rowcount > 0: if deleted_count > 0:
# Invalidate the cache # Invalidate the cache
self._invalidate_cache_and_stream( self._invalidate_cache_and_stream(
txn, txn,
...@@ -80,7 +82,7 @@ class EventForwardExtremitiesStore( ...@@ -80,7 +82,7 @@ class EventForwardExtremitiesStore(
(room_id,), (room_id,),
) )
return txn.rowcount return deleted_count
return await self.db_pool.runInteraction( return await self.db_pool.runInteraction(
"delete_forward_extremities_for_room", "delete_forward_extremities_for_room",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment