Don't refresh caches when deploying ebooks if there are more items in the build queue

This commit is contained in:
Alex Cabal 2022-07-13 02:44:44 -05:00
parent 47a5d3cd02
commit a9aa560dd3

View file

@ -20,7 +20,9 @@ USAGE
3. Generate various images and thumbnails for web use. 3. Generate various images and thumbnails for web use.
4. Generates RSS/Atom/OPDS feeds. 4. Generates RSS/Atom/OPDS feeds, but only if no other tasks are queued behind this one.
5. Generate bulk download files, but only if no other tasks are queued behind this one.
With --no-images, do not create cover thumbnails or hero images for the web. With --no-images, do not create cover thumbnails or hero images for the web.
@ -34,6 +36,8 @@ USAGE
With --no-feeds, don't generate RSS/Atom/OPDS feeds. With --no-feeds, don't generate RSS/Atom/OPDS feeds.
With --no-bulk-downloads, don't generate bulk download files.
EOF EOF
exit exit
} }
@ -51,6 +55,7 @@ lastPushHash=""
epubcheck="true" epubcheck="true"
recompose="true" recompose="true"
feeds="true" feeds="true"
bulkDownloads="true"
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
usage usage
@ -104,6 +109,10 @@ while [ $# -gt 0 ]; do
feeds="false" feeds="false"
shift 1 shift 1
;; ;;
--no-bulk-downloads)
bulkDownloads="false"
shift 1
;;
*) break ;; *) break ;;
esac esac
done done
@ -369,6 +378,15 @@ do
sudo chgrp --preserve-root --recursive "${group}" "${webRoot}/images/covers/" sudo chgrp --preserve-root --recursive "${group}" "${webRoot}/images/covers/"
sudo chmod --preserve-root --recursive g+ws "${webRoot}/images/covers/" sudo chmod --preserve-root --recursive g+ws "${webRoot}/images/covers/"
popd > /dev/null || die "Couldn't pop directory."
done
queuedTasks="false"
if tsp | grep --quiet --extended-regexp "^[0-9]+\s+queued"; then
queuedTasks="true"
fi
if [ "${queuedTasks}" = "false" ]; then
if [ "${verbose}" = "true" ]; then if [ "${verbose}" = "true" ]; then
printf "Rebuilding web library cache ... " printf "Rebuilding web library cache ... "
fi fi
@ -378,23 +396,52 @@ do
if [ "${verbose}" = "true" ]; then if [ "${verbose}" = "true" ]; then
printf "Done.\n" printf "Done.\n"
fi fi
else
popd > /dev/null || die "Couldn't pop directory." if [ "${verbose}" = "true" ]; then
done printf "Tasks queued after this one, not rebuilding web library cache.\n"
fi
fi
if [ "${feeds}" = "true" ]; then if [ "${feeds}" = "true" ]; then
# Build the various feeds catalog # Build the various feeds catalog, but only if we don't have more items in the tsp build queue.
if [ "${queuedTasks}" = "false" ]; then
if [ "${verbose}" = "true" ]; then if [ "${verbose}" = "true" ]; then
printf "Building feeds ... " printf "Building feeds ... "
fi fi
"${scriptsDir}/generate-feeds" --webroot "${webRoot}" --weburl "${webUrl}" "${scriptsDir}/generate-feeds" --webroot "${webRoot}" --weburl "${webUrl}"
sudo chown --recursive se:committers "${webRoot}"/{atom,rss,opds}/{*.xml,subjects} sudo chown --recursive se:committers "${webRoot}"/feeds/*/{*.xml,*/*.xml}
sudo chmod --recursive 664 "${webRoot}"/{atom,rss,opds}/{*.xml,subjects/*.xml} sudo chmod --recursive a+r,ug+w,a+X "${webRoot}"/feeds/*/
sudo chmod 775 "${webRoot}"/{atom,rss,opds}/subjects
if [ "${verbose}" = "true" ]; then if [ "${verbose}" = "true" ]; then
printf "Done.\n" printf "Done.\n"
fi fi
else
if [ "${verbose}" = "true" ]; then
printf "Tasks queued after this one, not building feeds.\n"
fi
fi
fi
if [ "${bulkDownloads}" = "true" ]; then
# Build the various feeds catalog, but only if we don't have more items in the tsp build queue.
if [ "${queuedTasks}" = "false" ]; then
if [ "${verbose}" = "true" ]; then
printf "Building bulk downloads ... "
fi
"${scriptsDir}/generate-bulk-downloads" --webroot "${webRoot}"
sudo chown --recursive se:committers "${webRoot}"/bulk-downloads/*/
sudo chmod --recursive a+r,ug+w,a+X "${webRoot}"/bulk-downloads/*/
if [ "${verbose}" = "true" ]; then
printf "Done.\n"
fi
else
if [ "${verbose}" = "true" ]; then
printf "Tasks queued after this one, not building bulk downloads.\n"
fi
fi
fi fi