Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def getHostByName(self, name, timeout=None):
- """Get host by name
- Args:
- name: The name of the host.
- timeout: The timeout.
- Return:
- Return host by name.
- """
- if name in dnscache:
- return defer.succeed(dnscache[name])
- # in Twisted<=16.6, getHostByName() is always called with
- # a default timeout of 60s (actually passed as (1, 3, 11, 45) tuple),
- # so the input argument above is simply overridden
- # to enforce Scrapy's DNS_TIMEOUT setting's value
- timeout = (self.timeout,)
- d = super(CachingThreadedResolver, self).getHostByName(name, timeout)
- if dnscache.limit:
- d.addCallback(self._cache_result, name)
- return d
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement