proxb / PoshRSJob

Provides an alternative to PSjobs with greater performance and less overhead to run commands in the background, freeing up the console and allowing throttling on the jobs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request: Implement 'BeginStop' into Stop-RSJob

gwpelletier opened this issue · comments

Feature request: Implement "BeginStop" asynchronous solution instead of current "Stop" solution. Stop is Synchronous and can take a long time to shutdown concurrent threads, especially if there are a bunch to shutdown.

Not a bug, just a request: When passing jobs to Stop-RSJob, use the asynchronous solution "BeginStop" instead of "Stop", then monitor all jobs until stopped. Once done, return out of Stop-RSJob

Reason for change: Using BeginStop will result in faster shutting down of threads as they will all start shutting down at the same time. This is also helpful from preventing pending jobs from starting, which looks like could happen.

BeginStop returns an Async handle that will need to be monitored for completion, but all handles can be monitored until Handle.IsCompleted is true.