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

convertExecArgv() embedded loop not completing before function #229

Closed
prestonvasquez opened this issue Jun 24, 2020 · 2 comments
Closed
Labels

Comments

@prestonvasquez
Copy link
Contributor

It looks like you're using an async function inside a for loop here:

https://github.com/taskforcesh/bullmq/blob/master/src/classes/child-pool.ts#L18

convertExecArgv() completes before the loop completes. I'm surprised this hasn't come up before, but I'm dealing with a fairly complex cluster of child processes. What do you guys think? It looks like the async loop function is used only for the sake of getPort()?

Maybe this would work better:

  for (let arg in execArgv) {
    if (arg.indexOf('--inspect') === -1) {
      standard.push(arg);
    } else {
      const argName = arg.split('=')[0];
      const port = await getPort();
      convertedArgs.push(`${argName}=${port}`);
    }
  };
@manast
Copy link
Contributor

manast commented Jun 24, 2020

yes thats definitely better, the older code is incorrect, must have been a copy paste error from Bullv3.
If you could make this into a PR I would gladly merge it ;).

@manast manast closed this as completed in d77505e Aug 8, 2020
github-actions bot pushed a commit that referenced this issue Oct 20, 2020
…10-20)

### Bug Fixes

* **job:** remove listeners before resolving promise ([563ce92](563ce92))
* **worker:** continue processing if handleFailed fails. fixes [#286](#286) ([4ef1cbc](4ef1cbc))
* **worker:** fix memory leak on Promise.race ([#282](#282)) ([a78ab2b](a78ab2b))
* **worker:** setname on worker blocking connection ([#291](#291)) ([50a87fc](50a87fc))
* remove async for loop in child pool fixes [#229](#229) ([d77505e](d77505e))

### Features

* **sandbox:** kill child workers gracefully ([#243](#243)) ([4262837](4262837))
@github-actions
Copy link

🎉 This issue has been resolved in version 1.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

No branches or pull requests

2 participants