Nodes/ComfyUI-AngelosKar/πŸ”„ AK Reset Counters
ComfyUI Node

πŸ”„ AK Reset Counters

The node that saves you restarting ComfyUI

By AngelosKar-codeΒ·Created 3 days agoΒ·Updated about 19 hours agoΒ· 0
πŸ”„ AK Reset Counters

      This one is barely a node. It has no inputs, no outputs, does nothing when it executes, and its Python function literally returns an empty tuple. It's a button with a node's costume on, and it solves a small, extremely irritating problem in the AK batch workflow: when your folder finally finishes and the scheduler throws its "all runs completed" error, the counter is sitting at the end and the batch won't start again until it's zeroed.

      How it works

      The reset is a frontend round-trip, not graph logic. The pack's JavaScript registers a button widget on the node titled πŸ”„ Reset All Counters. Clicking it walks the current graph for nodes of type AK_ImageListScheduler and AK_AutoImageListLoader, and POSTs each one's node id to the matching server endpoint (/angeloskar/reset_image_list_counter or /angeloskar/reset_auto_list_counter). The server sets that node's counter to 0, clears its cached settings hash so the next run starts clean, and prints a confirmation. That's the whole mechanism - no wires, no execution order to worry about, and it doesn't matter where on the canvas you drop it.

      The node is nonetheless declared as an output node in its schema, which means the engine always executes it. Harmless: the Python side is a no-op. All the work is in the browser.

      Why it's here at all

      The scheduler's counters live in server memory, keyed by node id. Nothing in ComfyUI gives you a native "zero my counter" affordance, so the alternatives are (a) restart the whole application, or (b) delete and re-add the scheduler node to hand it a new id. This node is the third option, and it also covers the case where you have three schedulers in one workflow and don't want to click three separate per-node reset buttons.

      If you only have one scheduler, you don't need it - the πŸ”„ Reset Counter button that ships on the scheduler node itself calls the same endpoint.

      Using it

      1. Drop it anywhere on the canvas. No connections.
      2. After a batch finishes (or when you just want to start over), click πŸ”„ Reset All Counters.
      3. The button label reports back: βœ… Reset N counters! on success, ⚠ No schedulers found if your graph has none, or ⚠ Reset N, failed M if a request errored.

      Install

      It comes with the pack, so:

      cd ComfyUI/custom_nodes
      git clone https://github.com/AngelosKar-code/ComfyUI-AngelosKar.git
      # restart ComfyUI
      

      Or ComfyUI Manager β†’ search ComfyUI-AngelosKar β†’ Install β†’ restart. torch, numpy, Pillow, aiohttp are listed as dependencies and are already in any working ComfyUI environment. Python 3.10+.

      Where people get burned

      If the button isn't there, the JavaScript didn't load. The node itself will still appear and still do nothing, because the panel is injected by the pack's frontend extension. Restart ComfyUI, then hard-refresh the browser (Ctrl-F5) - a cached app.js is the usual culprit after an install or update.

      "No active counter (already at 0)" is not an error. The server only has an entry for a scheduler node after it has executed at least once. If you drop a fresh scheduler and immediately try to reset, there's nothing to reset, and the endpoint says so.

      It resets counters, not queues. If the pending queue still has prompts in it, they'll run - this node only zeroes the batch bookkeeping. Pause or clear the queue first if you're aborting a run mid-way.

      Reset is per-graph. The JavaScript only sees nodes in the workflow currently open in your browser tab. Two tabs, two graphs, two separate clicks; and since the counters live on the server, a reloaded tab with the same workflow resets the same state.

      CategoryAngelosKar/Batch

      Inputs (0)

      No inputs

      Outputs (0)

      No outputs