0c099396ea3f96919b3e613b16b399516e446c16,src/python/pants/cache/cache_setup.py,CacheFactory,select_best_url,#CacheFactory#Any#,211

Before Change


    self._log.debug("Artifact cache server ping times: {}"
                    .format(", ".join(["{}: {:.6f} secs".format(*p) for p in pingtimes])))
    argmin = min(range(len(pingtimes)), key=lambda i: pingtimes[i][1])
    best_url = urls[argmin]
    if pingtimes[argmin][1] == Pinger.UNREACHABLE:
      return None  // No reachable artifact caches.
    self._log.debug("Best artifact cache is {0}".format(best_url))
    return best_url

After Change



  def select_best_url(self, remote_spec):
    urls = remote_spec.split("|")
    netloc_to_url = {urlparse.urlparse(url).netloc: url for url in urls}
    pingtimes = self._pinger.pings(netloc_to_url.keys())  // List of pairs (host, time in ms).
    self._log.debug("Artifact cache server ping times: {}"
                    .format(", ".join(["{}: {:.6f} secs".format(*p) for p in pingtimes])))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: pantsbuild/pants
Commit Name: 0c099396ea3f96919b3e613b16b399516e446c16
Time: 2015-10-05
Author: tansy.arron@gmail.com
File Name: src/python/pants/cache/cache_setup.py
Class Name: CacheFactory
Method Name: select_best_url


Project Name: commonsense/conceptnet5
Commit Name: 74a58ae6cd59e61a56b003964db85c9a213b0ea4
Time: 2020-03-03
Author: rspeer@luminoso.com
File Name: conceptnet5/nodes.py
Class Name:
Method Name: ld_node


Project Name: deepmipt/DeepPavlov
Commit Name: b552d0cb84cc02b40146982e926f56513c51cdaf
Time: 2020-11-10
Author: shuu01@gmail.com
File Name: deeppavlov/download.py
Class Name:
Method Name: download_resource