8aa6962feea3d82de4b697351040fadd50da2754
hiram
  Thu Aug 15 15:16:44 2019 -0700
begin to call bottleneck server at the very beginning of hgTracks and ready for other CGIs with library function refs #23217

diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c
index a9a1c13..69a507e 100644
--- src/hg/hgTracks/hgTracks.c
+++ src/hg/hgTracks/hgTracks.c
@@ -10047,41 +10047,45 @@
         // Add region only if it is not already in the existing highlight setting.
         char *alreadyIn = strstr(existing, newHighlight);
         int len = strlen(newHighlight);
         if (! (alreadyIn && (alreadyIn[len] == '|' || alreadyIn[len] == '\0')))
             {
             struct dyString *dy = dyStringCreate("%s|%s", newHighlight, existing);
             cartSetString(cart, "highlight", dy->string);
             }
         }
     else
         cartSetString(cart, "highlight", newHighlight);
     cartRemove(cart, "addHighlight");
     }
 }
 
+extern boolean issueBotWarning;
+
 void doMiddle(struct cart *theCart)
 /* Print the body of an html file.   */
 {
 cart = theCart;
 measureTiming = hPrintStatus() && isNotEmpty(cartOptionalString(cart, "measureTiming"));
 if (measureTiming)
-    measureTime("Startup");
+    measureTime("Startup (bottleneck %d ms) ", botDelayMillis);
 
-hgBotDelayFrac(0.25); /* Impose a quarter of the standard CGI penalty */
-if (measureTiming)
-    measureTime("Bottleneck delay");
+if (issueBotWarning)
+    {
+    char *ip = getenv("REMOTE_ADDR");
+    botDelayMessage(ip, botDelayMillis);
+    }
 
 char *debugTmp = NULL;
 /* Uncomment this to see parameters for debugging. */
 /* struct dyString *state = NULL; */
 /* Initialize layout and database. */
 if (measureTiming)
     measureTime("Get cart of %d for user:%s session:%s", theCart->hash->elCount,
 	    theCart->userId, theCart->sessionId);
 /* #if 1 this to see parameters for debugging. */
 /* Be careful though, it breaks if custom track
  * is more than 4k */
 #if  0
 state = cgiUrlString();
 printf("State: %s\n", state->string);
 #endif