mirror of
https://github.com/internetarchive/warcprox.git
synced 2025-01-18 13:22:09 +01:00
shut down immediately on disk full error
This commit is contained in:
parent
73d934d0a4
commit
1c035153de
2
setup.py
2
setup.py
@ -51,7 +51,7 @@ except:
|
||||
|
||||
setuptools.setup(
|
||||
name='warcprox',
|
||||
version='2.1b1.dev61',
|
||||
version='2.1b1.dev62',
|
||||
description='WARC writing MITM HTTP/S proxy',
|
||||
url='https://github.com/internetarchive/warcprox',
|
||||
author='Noah Levitt',
|
||||
|
@ -39,6 +39,7 @@ import hanzo.httptools
|
||||
from hanzo import warctools
|
||||
import warcprox
|
||||
import cProfile
|
||||
import sys
|
||||
|
||||
class WarcWriterThread(threading.Thread):
|
||||
logger = logging.getLogger("warcprox.warcproxwriter.WarcWriterThread")
|
||||
@ -102,8 +103,18 @@ class WarcWriterThread(threading.Thread):
|
||||
|
||||
self.logger.info('WarcWriterThread shutting down')
|
||||
self.writer_pool.close_writers()
|
||||
except:
|
||||
self.logger.critical("WarcWriterThread will try to continue after unexpected error", exc_info=True)
|
||||
except BaseException as e:
|
||||
if isinstance(e, OSError) and e.errno == 28:
|
||||
# OSError: [Errno 28] No space left on device
|
||||
self.logger.critical(
|
||||
'shutting down due to fatal problem: %s: %s',
|
||||
e.__class__.__name__, e)
|
||||
self.writer_pool.close_writers()
|
||||
sys.exit(1)
|
||||
|
||||
self.logger.critical(
|
||||
'WarcWriterThread will try to continue after unexpected '
|
||||
'error', exc_info=True)
|
||||
time.sleep(0.5)
|
||||
|
||||
# closest thing we have to heritrix crawl log at the moment
|
||||
|
Loading…
x
Reference in New Issue
Block a user