From b25cf5618157fe1d191b846f5279ddfeb68fad9d Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Sun, 30 Nov 2025 22:05:14 -0800 Subject: [PATCH] Rename and remove redundant logic --- javascript/gallery.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/javascript/gallery.js b/javascript/gallery.js index e2fde6291..ed3bd9fdb 100644 --- a/javascript/gallery.js +++ b/javascript/gallery.js @@ -67,12 +67,10 @@ class SimpleFunctionQueue { return; } this.#queue.push(config); - if (!this.#running) { - this.#runNext(); - } + this.#tryRunNext(); } - async #runNext() { + async #tryRunNext() { if (this.#running || !this.#queue.length) return; try { const { signal, callback } = this.#queue.shift(); @@ -85,7 +83,7 @@ class SimpleFunctionQueue { error(`${this.#id} Queue:`, err); } finally { this.#running = false; - this.#runNext(); + this.#tryRunNext(); } } }