mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
Fix the return type of send_nonmember_events. (#8112)
This commit is contained in:
parent
5cf7c12995
commit
3c01724b33
1
changelog.d/8112.misc
Normal file
1
changelog.d/8112.misc
Normal file
@ -0,0 +1 @@
|
||||
Return the previous stream token if a non-member event is a duplicate.
|
@ -674,7 +674,7 @@ class EventCreationHandler(object):
|
||||
event.event_id,
|
||||
prev_event.event_id,
|
||||
)
|
||||
return await self.store.get_stream_token_for_event(prev_event.event_id)
|
||||
return await self.store.get_stream_id_for_event(prev_event.event_id)
|
||||
|
||||
return await self.handle_new_client_event(
|
||||
requester=requester, event=event, context=context, ratelimit=ratelimit
|
||||
|
@ -582,6 +582,19 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
|
||||
)
|
||||
return "t%d-%d" % (topo, token)
|
||||
|
||||
async def get_stream_id_for_event(self, event_id: str) -> int:
|
||||
"""The stream ID for an event
|
||||
Args:
|
||||
event_id: The id of the event to look up a stream token for.
|
||||
Raises:
|
||||
StoreError if the event wasn't in the database.
|
||||
Returns:
|
||||
A stream ID.
|
||||
"""
|
||||
return await self.db_pool.simple_select_one_onecol(
|
||||
table="events", keyvalues={"event_id": event_id}, retcol="stream_ordering"
|
||||
)
|
||||
|
||||
async def get_stream_token_for_event(self, event_id: str) -> str:
|
||||
"""The stream token for an event
|
||||
Args:
|
||||
@ -591,10 +604,8 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
|
||||
Returns:
|
||||
A "s%d" stream token.
|
||||
"""
|
||||
row = await self.db_pool.simple_select_one_onecol(
|
||||
table="events", keyvalues={"event_id": event_id}, retcol="stream_ordering"
|
||||
)
|
||||
return "s%d" % (row,)
|
||||
stream_id = await self.get_stream_id_for_event(event_id)
|
||||
return "s%d" % (stream_id,)
|
||||
|
||||
async def get_topological_token_for_event(self, event_id: str) -> str:
|
||||
"""The stream token for an event
|
||||
|
Loading…
Reference in New Issue
Block a user