Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Move up the #_busy flag to fix the synchronization queue error. #57

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

floatcat
Copy link

@floatcat floatcat commented Mar 6, 2025

  #run() {
    if (this.#completed !== this.#total) {
      if (!this.#_paused && this.#running < this.#_concurrency) {
        const difference = this.#_concurrency - this.#running;

        const tasks = this.#_pending.removeRange(0, difference) as Tasks<T>;

        tasks.forEach((task) => {
          task.status = TaskStatus.RUNNING;

          this.#_running.add(task);

          task.run(this.#done(task)); // will call the #run and set #_busy at first

          /* istanbul ignore next */
          this.#runHook(RunnerEvents.RUN, {
            task,
          });
        });

        this.#_busy = true; // is too late
      }
.......

Move up the #_busy flag can fix the synchronization queue error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant