5f5f13fd06770522984306094db7871be67aeb40 max Tue Sep 22 14:25:50 2020 -0700 fixing error in hgLib where a missing bottleneck server leads to a crash, no redmine yet, email from Braney diff --git src/hg/pyLib/hgLib.py src/hg/pyLib/hgLib.py index 48c0cdc..8e25281 100644 --- src/hg/pyLib/hgLib.py +++ src/hg/pyLib/hgLib.py @@ -459,31 +459,31 @@ This behaves similar to the function src/hg/lib/botDelay.c:hgBotDelay It does not use the hgsid, currently it always uses the IP address. Using the hgsid makes little sense. It is more lenient than the C version. """ global hgConf global doWarnBot global botDelayMsecs ip = os.environ.get("REMOTE_ADDR") if not ip: # skip if not called from Apache return host = cfgOption("bottleneck.host") port = cfgOption("bottleneck.port") - if not "bottleneck.host" or not "bottleneck.port" or not ip: + if not host or not port or not ip: return botCheckString = getBotCheckString(ip, fraction) millis = botDelayTime(host, port, botCheckString) debug(1, "Bottleneck delay: %d msecs" % millis) botDelayMsecs = millis if millis>botDelayBlock: # retry-after time factor 10 is based on the example in the bottleneck help message errAbort("Too many HTTP requests and not enough delay between them. " "Your IP has been blocked to keep this website responsive for other users. " "Please contact genome-www@soe.ucsc.edu to unblock your IP address. We can also help you obtain the data you need without " "web crawling. ", status=429, headers = {"Retry-after" : str(millis / 10)}) sys.stderr.write("hgLib.py hogExit\n") sys.exit(0)