ansible: FileService wasn't sleeping properly.

"_schedule_pending" is a function, "_pending_by_stream" is the map we
want to test.
pull/219/head
David Wilson 8 years ago
parent 3978e4e165
commit 2f1df7f82d

@ -420,7 +420,7 @@ class FileService(mitogen.service.Service):
#: Time spent by the scheduler thread asleep when it has no more data to #: Time spent by the scheduler thread asleep when it has no more data to
#: pump, but while at least one transfer remains active. With #: pump, but while at least one transfer remains active. With
#: max_queue_size=1MiB and a sleep of 10ms, maximum throughput on any #: max_queue_size=1MiB and a sleep of 10ms, maximum throughput on any
#: single stream is 100MiB/sec, which is 5x what SSH can handle on my #: single stream is 112MiB/sec, which is >5x what SSH can handle on my
#: laptop. #: laptop.
sleep_delay_ms = 0.01 sleep_delay_ms = 0.01
@ -500,7 +500,7 @@ class FileService(mitogen.service.Service):
:meth:`on_shutdown` hasn't been called yet, otherwise :meth:`on_shutdown` hasn't been called yet, otherwise
:data:`False`. :data:`False`.
""" """
if self._schedule_pending: if self._pending_by_stream:
timeout = self.sleep_delay_ms timeout = self.sleep_delay_ms
else: else:
timeout = None timeout = None
@ -523,7 +523,7 @@ class FileService(mitogen.service.Service):
""" """
Scheduler thread's main function. Sleep until Scheduler thread's main function. Sleep until
:meth:`_sleep_on_queue` indicates the queue has been shut down, :meth:`_sleep_on_queue` indicates the queue has been shut down,
pending pending file chunks each time we wake. pumping pending file chunks each time we wake.
""" """
while self._sleep_on_queue(): while self._sleep_on_queue():
for stream, pending in list(self._pending_by_stream.items()): for stream, pending in list(self._pending_by_stream.items()):

Loading…
Cancel
Save