Skip to content

Commit e7132c3

Browse files
Fix check to ignore blank lines in incoming TCP replication (#14449)
1 parent 75888c2 commit e7132c3

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

changelog.d/14449.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix type logic in TCP replication code that prevented correctly ignoring blank commands.

synapse/replication/tcp/protocol.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def lineReceived(self, line: bytes) -> None:
245245
self._parse_and_dispatch_line(line)
246246

247247
def _parse_and_dispatch_line(self, line: bytes) -> None:
248-
if line.strip() == "":
248+
if line.strip() == b"":
249249
# Ignore blank lines
250250
return
251251

synapse/storage/database.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -569,15 +569,15 @@ async def _check_safe_to_upsert(self) -> None:
569569
retcols=["update_name"],
570570
desc="check_background_updates",
571571
)
572-
updates = [x["update_name"] for x in updates]
572+
background_update_names = [x["update_name"] for x in updates]
573573

574574
for table, update_name in UNIQUE_INDEX_BACKGROUND_UPDATES.items():
575-
if update_name not in updates:
575+
if update_name not in background_update_names:
576576
logger.debug("Now safe to upsert in %s", table)
577577
self._unsafe_to_upsert_tables.discard(table)
578578

579579
# If there's any updates still running, reschedule to run.
580-
if updates:
580+
if background_update_names:
581581
self._clock.call_later(
582582
15.0,
583583
run_as_background_process,

0 commit comments

Comments
 (0)