Skip to content

Commit

Permalink
Flush error response before raise server error
Browse files Browse the repository at this point in the history
  • Loading branch information
danijar committed Sep 12, 2024
1 parent 9bebe67 commit d23d349
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion portal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '3.2.0'
__version__ = '3.2.1'

import multiprocessing as mp
try:
Expand Down
3 changes: 3 additions & 0 deletions portal/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,7 @@ def _error(self, addr, reqnum, status, message):
data = message.encode('utf-8')
self.socket.send(addr, reqnum, status, data)
if self.errors:
# Wait until the error is delivered to the client and then raise.
self.socket.shutdown()
self.socket.close()
raise RuntimeError(message)
1 change: 0 additions & 1 deletion portal/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class Thread:
"""

def __init__(self, fn, *args, name=None, start=False):
global TIDS
self.fn = fn
self.excode = None
name = name or getattr(fn, '__name__', 'thread')
Expand Down

0 comments on commit d23d349

Please sign in to comment.