Skip to content

Commit

Permalink
Merge pull request #101 from ska-sa/NGC-1440-samplers-too-slow
Browse files Browse the repository at this point in the history
Avoid ?sensor-sampling potentially disconnecting clients
  • Loading branch information
bmerry authored Oct 22, 2024
2 parents 59b8e55 + 28ef780 commit c1c2a0f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/aiokatcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,12 @@ def send_version_info(self, ctx: RequestContext, *, send_reply=True) -> None:

def _write_async_message(self, conn: ClientConnection, msg: core.Message) -> None:
conn.write_message(msg)
if conn.writer is not None:
# ?sensor-sampling with a bulk list of sensors causes large amounts of
# data (initial sensor values) to be dumped into the stream at once,
# and it's only drained in batches (for efficiency). So we suspend the
# usual heuristic for detecting too-slow clients while that is in
# progress.
if conn.writer is not None and not conn.samplers_lock.locked():
transport = cast(asyncio.WriteTransport, conn.writer.transport)
backlog = transport.get_write_buffer_size()
if backlog > self.max_backlog:
Expand Down

0 comments on commit c1c2a0f

Please sign in to comment.