fix: make input-folder watching opt-in (default off) to keep restarts fast

Folding the input-dir mtime into the cache fingerprint backfired on busy input
folders (e.g. a video workflow constantly adding clips): the input dir changed
on nearly every restart, invalidating the cache and forcing a ~5-min rebuild of
the (now 74 MB) object_info over the CIFS model mount on each load -- the exact
slowness the pack exists to avoid.

Input watching is now opt-in via TENACIOUSLOAD_WATCH_INPUT=1. By default new
input files are picked up via a refresh button, same as new models. Node code
changes are still auto-detected. Unit-tested.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-21 08:50:57 +02:00
parent 0d2b5e0819
commit ddbaa21b10
2 changed files with 20 additions and 9 deletions
+7
View File
@@ -107,6 +107,13 @@ python main.py --listen --port 8188 --enable-compress-response-body
button, to force a rebuild. button, to force a rebuild.
- An nginx reverse proxy can cache `object_info` at the HTTP layer too, but this - An nginx reverse proxy can cache `object_info` at the HTTP layer too, but this
pack does it in-process so no extra service, container, or port is needed. pack does it in-process so no extra service, container, or port is needed.
- **New files in the `input` folder** are picked up by a **refresh button** by
default (same as new models) — they do *not* trigger an automatic rebuild on
restart. To auto-detect them on restart instead, set
`TENACIOUSLOAD_WATCH_INPUT=1`. Only do this if your input folder is fairly
static: on a busy input folder (e.g. a video workflow that adds clips
constantly) the input dir changes on nearly every restart, which would
invalidate the cache and force a slow rebuild each time — defeating the point.
## Installing / updating other custom nodes ## Installing / updating other custom nodes
This pack is a quiet neighbour: This pack is a quiet neighbour:
+9 -5
View File
@@ -362,11 +362,15 @@ def _current_node_signature():
except Exception as e: # pragma: no cover except Exception as e: # pragma: no cover
log.warning("Tenaciousload: custom_nodes code hash failed: %s", e) log.warning("Tenaciousload: custom_nodes code hash failed: %s", e)
code = "" code = ""
# input-dir mtime: LoadImage etc. list the input folder (non-recursively) in # Optionally fold in the input-dir mtime so new files in the input folder
# their INPUT_TYPES, so it rides along in object_info. The dir's own mtime # show up after a restart. OFF BY DEFAULT: on a high-churn input folder
# changes when files are added/removed there, so a restart picks them up. # (e.g. a video workflow that constantly adds clips) it changes on nearly
# (Cheap: one stat. Model folders are on a slow mount + nested, so they are # every restart, invalidating the cache and forcing a slow rebuild — which
# NOT fingerprinted here — use a refresh button for new models.) # defeats the whole point. Enable with TENACIOUSLOAD_WATCH_INPUT=1 only if
# your input folder is fairly static. Otherwise use a refresh button for new
# input files, same as for new models.
inp = ""
if os.environ.get("TENACIOUSLOAD_WATCH_INPUT", "").strip().lower() in ("1", "true", "yes", "on"):
try: try:
inp = str(os.path.getmtime(folder_paths.get_input_directory())) inp = str(os.path.getmtime(folder_paths.get_input_directory()))
except Exception: except Exception: