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

Commit 4d8735a

Browse files
committed
Correctly handle the different cases
1 parent 6069348 commit 4d8735a

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

synapse/replication/tcp/resource.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,22 @@ async def _run_notifier_loop(self) -> None:
204204
# The token has advanced but there is no data to
205205
# send, so we send a `POSITION` to inform other
206206
# workers of the updated position.
207-
208-
# We skip this for the `caches` stream as a) it
209-
# generates a lot of traffic as every worker would
210-
# echo each write, and b) nothing cares if a given
211-
# worker's caches stream position lags.
207+
#
208+
# There are two reasons for this: 1) this instance
209+
# requested a stream ID but didn't use it, or 2)
210+
# this instance advanced its own stream position due
211+
# to receiving notifications about other instances
212+
# advancing their stream position.
213+
214+
# We skip sending `POSITION` for the `caches` stream
215+
# for the second case as a) it generates a lot of
216+
# traffic as every worker would echo each write, and
217+
# b) nothing cares if a given worker's caches stream
218+
# position lags.
212219
if stream.NAME == CachesStream.NAME:
213-
continue
220+
# If there haven't been any writes
221+
if stream.minimal_local_current_token() <= last_token:
222+
continue
214223

215224
# Note: `last_token` may not *actually* be the
216225
# last token we sent out in a RDATA or POSITION.

0 commit comments

Comments
 (0)