mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-23 12:43:10 +00:00
Fix 'Too many open files' error.
Happened before after continuous archiving of few hundreds links. Fix by: * setting process object to `None` to trigger GC finalizer cleanup of pipe descriptors * protecting against double cleanup
This commit is contained in:
parent
91d60364de
commit
03c1b0009c
1 changed files with 6 additions and 0 deletions
|
@ -161,7 +161,13 @@ def progress(seconds=TIMEOUT, prefix=''):
|
||||||
|
|
||||||
def end():
|
def end():
|
||||||
"""immediately finish progress and clear the progressbar line"""
|
"""immediately finish progress and clear the progressbar line"""
|
||||||
|
nonlocal p
|
||||||
|
if p is None: # protect from double termination
|
||||||
|
return
|
||||||
|
|
||||||
p.terminate()
|
p.terminate()
|
||||||
|
p = None
|
||||||
|
|
||||||
sys.stdout.write('\r{}{}\r'.format((' ' * TERM_WIDTH), ANSI['reset'])) # clear whole terminal line
|
sys.stdout.write('\r{}{}\r'.format((' ' * TERM_WIDTH), ANSI['reset'])) # clear whole terminal line
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue