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

add execDirect #442

Closed
wants to merge 1 commit into from
Closed

add execDirect #442

wants to merge 1 commit into from

Conversation

frankie-zeng
Copy link

@frankie-zeng frankie-zeng commented Apr 16, 2024

allow multi task run in worker at same time

var workerpool = require('../../');
var ac
function start() {
  ac=new AbortController();
  return new Promise(function (resolve, reject) {
    ac.signal.onabort = () => {
        resolve('aborted');
    };
});  
}
function stop() {
  ac.abort();
}

// create a worker and register some functions
workerpool.worker({
    start: start,
    stop:stop
});
pool.execDirect('start',[]).then((val)=>{
      assert.strictEqual(val,'aborted');
      done();
    }).catch(done)
    pool.execDirect('stop',[])

@josdejong
Copy link
Owner

Thanks for your PR. Can you elaborate on what the PR does? Is it about adding support for an AbortController like in #441?

I see you deleted test files Pool.test.js and Promis.test.js, that should not be done. These test files are necessary to ensure the behavior of the library is as we want.

@josdejong
Copy link
Owner

?

@frankie-zeng
Copy link
Author

?

I will fix the code and reopen a new PR. thanks.

@josdejong
Copy link
Owner

Ok!

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.

None yet

2 participants