Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout and check on write #653

Merged
merged 2 commits into from
Nov 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions distributed/batched.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,7 @@ def send_next(self, wait=True):
wait_time = min(self.last_transmission + self.interval - now,
self.interval)
yield gen.sleep(wait_time)
while self.stream._write_buffer:
try:
yield gen.with_timeout(timedelta(milliseconds=10),
self.last_send) # hangs otherwise?
except gen.TimeoutError:
pass
yield self.last_send
self.buffer, payload = [], self.buffer
self.last_payload = payload
self.last_transmission = now
Expand Down
10 changes: 6 additions & 4 deletions distributed/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,12 @@ def write(stream, msg):

futures.append(stream.write(frames[-1]))

if WINDOWS:
yield futures[-1]
else:
yield futures
while stream._write_buffer:
try:
yield gen.with_timeout(timedelta(seconds=0.01), futures[-1])
break
except gen.TimeoutError:
pass


def pingpong(stream):
Expand Down