added setting to support disabling DNS cache: DNSCACHE_ENABLED

This commit is contained in:
Pablo Hoffman 2011-08-05 20:41:59 -03:00
parent bb67cfd955
commit 9f60c27612
3 changed files with 13 additions and 1 deletions

View File

@ -366,6 +366,15 @@ Default: ``False``
Whether to collect verbose depth stats. If this is enabled, the number of
requests for each depth is collected in the stats.
.. setting:: DNSCACHE_ENABLED
DNSCACHE_ENABLED
----------------
Default: ``True``
Whether to enable DNS in-memory cache.
.. setting:: DOWNLOADER_DEBUG
DOWNLOADER_DEBUG

View File

@ -70,7 +70,8 @@ class CrawlerProcess(Crawler):
def start(self):
super(CrawlerProcess, self).start()
reactor.installResolver(CachingThreadedResolver(reactor))
if self.settings.getbool('DNSCACHE_ENABLED'):
reactor.installResolver(CachingThreadedResolver(reactor))
reactor.addSystemEventTrigger('before', 'shutdown', self.stop)
reactor.run(installSignalHandlers=False) # blocking call

View File

@ -49,6 +49,8 @@ DEPTH_LIMIT = 0
DEPTH_STATS = True
DEPTH_PRIORITY = 1
DNSCACHE_ENABLED = True
DOWNLOAD_DELAY = 0
DOWNLOAD_HANDLERS = {}