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: Clear the timer for task timeout after the task has completed #79

Merged
merged 1 commit into from
Sep 25, 2023
Merged

fix: Clear the timer for task timeout after the task has completed #79

merged 1 commit into from
Sep 25, 2023

Conversation

katsuya
Copy link
Contributor

@katsuya katsuya commented Sep 21, 2023

The timer for task timeout is not cleared with clearTimeout, causing it to persist in the event loop even after the task has finished processing. As a result, the Node.js process cannot terminate until the time specified for the timer has elapsed. The issue can be replicated using the following code:

 await PromisePool.for([...Array(100).keys()])
    .withConcurrency(100)
    .withTaskTimeout(180 * 1000)
    .process(async (key, _index, _pool) => {
      return key
    })

const info = process.getActiveResourcesInfo()
console.log({ info })

@marcuspoehls
Copy link
Member

@katsuya Hey Katsuya, good catch! Thank you for the pull request 😊 I'll merge it today and publish a new release

@marcuspoehls marcuspoehls merged commit d0dc445 into supercharge:main Sep 25, 2023
3 checks passed
@marcuspoehls
Copy link
Member

@katsuya I’ve published version 3.1.0 containing your timer improvements. Thank you!

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.

2 participants