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

Node: Add new worker.on('subprocessclose') to fix Node tests #1307

Merged
merged 4 commits into from
Jan 9, 2024
Merged

Commits on Jan 8, 2024

  1. Fix Node tests

    Fixes #1306
    
    ### Details
    
    - Problem only happened when running a test file separately (it worked by accident when running all together as usual).
    - Problem was that the `ChildProcess` object in `Worker` (the `this.#child` member) remains open for a bit until it emits 'close' event, which is emitted after 'exit' event or after 'error' event.
    - Here we have added a new 'subprocessclose' event in `Worker` which is emitted when the worker subprocess has closed. It may be (and it will be) emitted AFTER calling `worker.close()` but not immediately after it.
    - This event is basically useful for scenarios like testing where we want to verify that nothing remains running/open when a test is finished.
    - Also added a `worker.subprocessClosed` getter.
    - Removed an ugly `setTimeout` in `Channel::close()` method. If the app wants to get the very latest notifications/logs from worker when closing it, use the above event to wait for final closure.
    
    ### Bonus Tracks
    
    - Be consistent in command line arguments and always use `--option-foo bar` instead of `--option-foo=bar`.
    ibc committed Jan 8, 2024
    Configuration menu
    Copy the full SHA
    411d32e View commit details
    Browse the repository at this point in the history
  2. Update CHANGELOG

    ibc committed Jan 8, 2024
    Configuration menu
    Copy the full SHA
    905d4ce View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    cae1ac6 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    7ac624b View commit details
    Browse the repository at this point in the history