move q.close() to where it will be called even if deadline is hit
This commit is contained in:
parent
dce6eee8c9
commit
a003c97fba
1 changed files with 2 additions and 1 deletions
|
@ -393,7 +393,6 @@ def deadline_process(func: typing.Callable[[], None], seconds: int=10):
|
|||
q.put([True, func()])
|
||||
except Exception as e:
|
||||
q.put([False, e])
|
||||
q.close()
|
||||
|
||||
p = multiprocessing.Process(target=_wrap, args=(func, q))
|
||||
p.start()
|
||||
|
@ -404,6 +403,8 @@ def deadline_process(func: typing.Callable[[], None], seconds: int=10):
|
|||
except queue.Empty:
|
||||
p.kill()
|
||||
deadlined = True
|
||||
finally:
|
||||
q.close()
|
||||
|
||||
if deadlined:
|
||||
_raise_deadline()
|
||||
|
|
Loading…
Reference in a new issue