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/renderMain.c src/hg/hgTracks/renderMain.c
index 400a13d..b2cdf7b 100644
--- src/hg/hgTracks/renderMain.c
+++ src/hg/hgTracks/renderMain.c
@@ -5,30 +5,31 @@
  * See README in this or parent directory for licensing information. */
 
 #include "common.h"
 #include "linefile.h"
 #include "hash.h"
 #include "htmshell.h"
 #include "options.h"
 #include "errAbort.h"
 #include "portable.h"
 #include "cheapcgi.h"
 #include "ra.h"
 #include "hdb.h"
 #include "net.h"
 #include "hgTracks.h"
 #include "imageV2.h"
+#include "botDelay.h"
 
 static void usage()
 /* Print out usage and exit - just temporary. */
 {
 errAbort(
 "hgRenderTracks - execute enough of browser to render a list of tracks\n"
 "usage:\n"
 "      hgTrackRender track.ra cart.ra output.ps\n"
 "where track.ra is a trackDb.ra entry flattened out to include stuff inherited from parent\n"
 "and cart.ra is a file with the cart settings.  Both .ra files should just have a single stanza\n"
 );
 }
 
 static struct optionSpec options[] = {
    {NULL, 0},
@@ -95,35 +96,38 @@
 for (track = trackList; track != NULL; track = track->next)
     {
     track->loadItems(track);
     }
 verboseTime(2, "After load");
 
 /* Initialize global image box. */
 int sideSliceWidth  = 0;   // Just being explicit
 if (withLeftLabels)
     sideSliceWidth   = (insideX - gfxBorder*3) + 2;
 theImgBox = imgBoxStart(database,chromName,winStart,winEnd,(!revCmplDisp),sideSliceWidth,tl.picWidth);
 makeActiveImage(trackList, NULL);
 verboseTime(2,"After makeActiveImage");
 }
 
+boolean issueBotWarning;
+
 int main(int argc, char *argv[])
 {
 if(argc == 1)
     {
     long enteredMainTime = clock1000();
+    issueBotWarning = earlyBotCheck(enteredMainTime, "hgRenderTracks", delayFraction, warnMs, exitMs);
     // CGI call
 
     // htmlPushEarlyHandlers(); XXXX do I need to do this?
 
     hPrintDisable();
     oldVars = hashNew(10);
     struct cart *cart = cartForSession(hUserCookie(), excludeVars, oldVars);
 
     // setup approriate CGI variables which tell hgTracks code what to do.
     cartSetBoolean(cart, "hgt.trackImgOnly", TRUE);
     if(cartVarExists(cart, "jsonp"))
         {
         // experimental code to support remote rendering via a jsonp callback
         // e.g.: /cgi-bin/hgRenderTracks?track=bamMMS9MbutiPygmy&track=...&jsonp=remoteTrackCallback&postion=...&pix=800
         cartSetString(cart, "hgt.contentType", "jsonp");