da842745b8ff9da265c8ada03422c4b52cf48c8a
hiram
  Mon Aug 19 07:54:11 2019 -0700
calling earlyBotCheck to add to botDelay penalty time for custom tracks created refs #23217

diff --git src/hg/lib/customTrack.c src/hg/lib/customTrack.c
index 4bacf86..6c0b6b7 100644
--- src/hg/lib/customTrack.c
+++ src/hg/lib/customTrack.c
@@ -16,30 +16,31 @@
 #include "jksql.h"
 #include "customTrack.h"
 #include "ctgPos.h"
 #include "psl.h"
 #include "gff.h"
 #include "genePred.h"
 #include "net.h"
 #include "hdb.h"
 #include "hui.h"
 #include "cheapcgi.h"
 #include "wiggle.h"
 #include "hgConfig.h"
 #include "customFactory.h"
 #include "trashDir.h"
 #include "jsHelper.h"
+#include "botDelay.h"
 
 static boolean printSaveList = FALSE; // if this is true, we print to stderr the number of custom tracks saved
 
 /* Track names begin with track and then go to variable/value pairs.  The
  * values must be quoted if they include white space. Defined variables are:
  *  name - any text up to 15 letters.
  *  description - any text up to 60 letters.
  *  url - URL.  If it contains '$$' this will be substituted with itemName.
  *  visibility - 0=hide, 1=dense, 2=full, 3=pack, 4=squish
  *  useScore - 0=use colors. 1=use grayscale based on score.
  *  color = R,G,B,  main color, should be dark.  Components from 0-255.
  *  altColor = R,G,B secondary color.
  *  priority = number.
  */
 
@@ -935,30 +936,38 @@
                         }
                     }
                 break;
                 }
             }
         }
     cartRemove(cart, CT_SELECTED_TABLE_VAR);
     }
 
 /* merge new and old tracks */
 numAdded = slCount(newCts);
 if (numAdded)
     {
     fprintf(stderr, "customTrack: new %d from %s\n", numAdded, customText);
     printSaveList = TRUE;
+    /* add penalty in relation to number of tracks created
+     * the delayFraction here is 0.25 as it is in hgTracks
+     * the enteredMainTime is 0 since this is not important here
+     * the warnMs and exitMs are set at 1,000,000 since we do *not* want
+     * any exit here, and the return code issueBotWarning is ignored
+     * this is merely to accumulate penalty time.
+     */
+    (void) earlyBotCheck(0, "hgTracks", (double)(numAdded + 1) * 0.25, 1000000, 1000000);
     }
 
 ctList = customTrackAddToList(ctList, newCts, &replacedCts, FALSE);
 for (ct = ctList; ct != NULL; ct = ct->next)
     if (trackDbSetting(ct->tdb, CT_UNPARSED))
         {
         ctRemoveFromSettings(ct, CT_UNPARSED);
         changedCt = TRUE;
         }
 if (newCts || removedCt || changedCt || ctConfigUpdate(ctFileName))
     {
     customTracksSaveCart(genomeDb, cart, ctList);
     // If all CTs have been removed then customTrackFileVar is also removed from cart, so optional:
     ctFileName = cartOptionalString(cart, customTrackFileVar(genomeDb));
     }