79837f643d9b21431d679ea7216f7e68150b2adf
hiram
  Mon May 11 15:34:40 2026 -0700
making the ottoRequestView CGI efficient and avoiding repeatedly scanning files to get numbers that are not changing refs #31811

diff --git src/hg/utils/otto/userRequests/ottoRequestWatch.sh src/hg/utils/otto/userRequests/ottoRequestWatch.sh
index d7f04a86d82..20d85258cd8 100755
--- src/hg/utils/otto/userRequests/ottoRequestWatch.sh
+++ src/hg/utils/otto/userRequests/ottoRequestWatch.sh
@@ -240,30 +240,42 @@
 ##############################################################################
 ### refresh Galaxy queue status snapshot for ottoRequestView.cgi
 ##############################################################################
 export galaxyStatusFile="/data/apache/trash/ottoRequestGalaxyStatus.json"
 export profileJson="${HOME}/.planemo/profiles/vgp/planemo_profile_options.json"
 gsTmp=$(mktemp "${galaxyStatusFile}.XXXXXX")
 if timeout 45 "${scriptDir}/galaxyStatus.py" "${profileJson}" > "${gsTmp}" 2>/dev/null; then
   chmod 664 "${gsTmp}"
   mv "${gsTmp}" "${galaxyStatusFile}"
 else
   rm -f "${gsTmp}"
 #  printf "# WARNING: galaxyStatus.py failed, leaving stale snapshot\n" 1>&2
 fi
 ##############################################################################
 
+##############################################################################
+### refresh featureBits coverage snapshot for ottoRequestView.cgi
+###   append-only; script reads its current snapshot and only measures
+###   pairs not already recorded, so per-tick cost is ~zero in steady
+###   state.  Has its own singleton lock, writes its own snapshot file
+###   atomically, exits 0 silently when nothing to do.
+##############################################################################
+if ! timeout 45 "${scriptDir}/featureBitsSnapshot.py" 2>/dev/null; then
+  : # non-zero exit ignored: leave stale snapshot, next tick will retry
+fi
+##############################################################################
+
 ############################################################################
 # phase 0: pre-flight existing-work detection.  If the alignment has
 #          already been built in-house (legacy lastz/chain/net or an
 #          earlier kegAlign run), the only step left is the hgdownload
 #          push.  Signals (all must hold):
 #            /hive/data/genomes/${fromDb}/bed/lastz.${toDb}  symlink exists
 #            /hive/data/genomes/${toDb}/bed/lastz.${fromDb}  symlink exists
 #            hgcentraltest.liftOverChain   has both directions
 #            hgcentraltest.quickLiftChain  has both directions
 #          When all four hold, fill in buildDir with the resolved
 #          fromDb-side build dir and bump status=5 so
 #          ottoRequestPush.py picks it up.  Anything that doesn't match
 #          stays at status=1 and falls through to phase 1.
 ############################################################################
 while IFS=$'\t' read -r reqId fromDb toDb; do