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.
MIT License
541 stars 87 forks source link

HasMoreData is always False #200

Open RichardBenfield opened 5 years ago

RichardBenfield commented 5 years ago

Do you want to request a feature or report a bug? bug

What is the current behavior? All jobs always appear to have a 'HasMoredata' property of False. Even though receive data shows that each job does in fact have data.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem Create any jobs with Start-RSJob that returns data, then use Get-RSJob and Receive-RSJob. The Get-RSJob will show that each job has a "HasMoreData" property of False. Receive-RSJob will show that each job actually does contain data.

What is the expected behavior? HasMoreData should be True, when it has data. Ideally, when received, the data would be cleared from the job and the HasMoreData property would be set to False.

Which versions of Powershell and which OS are affected by this issue? Did this work in previous versions of our scripts? Name Value


PSVersion 5.1.17134.765 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.17134.765 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1

ModuleType Version Name ExportedCommands


Script 1.7.4.4 PoshRSJob {Get-RSJob, Receive-RSJob, Remove-RSJob, Start-RSJob...}

Please provide a code example showing the issue, if applicable: Example from https://learn-powershell.net/2015/03/31/introducing-poshrsjob-as-an-alternative-to-powershell-jobs/


$Test = 42
1..5|Start-RSJob -Name {"TEST_$($_)"} -ScriptBlock {
    Param($Object)
    $DebugPreference = 'Continue'
    $PSBoundParameters.GetEnumerator() | ForEach {
        Write-Debug $_
    }
    Write-Verbose "Creating object" -Verbose
    New-Object PSObject -Property @{
        Object=$Object
        Test=$Using:Test
    }
}```
MVKozlov commented 5 years ago

Don't know why @proxb use string test for output... because my PRs wait for merging so much time already you can try my own fork

kborowinski commented 5 years ago

@MVKozlov : Question, I am using your PerJobTimeout branch on daily basis. Do you plan to merge it with your master? I am asking because you have just merged probx#200 to master and it fixes important issue which is still not solved in PerJobTimeout branch.

RichardBenfield commented 5 years ago

Thank You @MVKozlov. Your fork is working great!

MVKozlov commented 5 years ago

@kborowinski It already merged. May be I should remove it...

kborowinski commented 5 years ago

@MVKozlov: If PerJobTimeout branch is merged with master then I think that it would be good idea to remove it. The same with PreserveJobsOrder

MVKozlov commented 5 years ago

I do not remove PreserveJobsOrder until now because I create PR from it. But may be this is a time...

kborowinski commented 5 years ago

@MVKozlov: I have just tried to import latest version of PoshRSJob (1.7.5.1) from your repository and it gives small warning:

> Import-Module PoshRSJob -Verbose
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PoshRSJob\1.7.5.1\PoshRSJob.psd1'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PoshRSJob\1.7.5.1\Scripts\TabExpansion.ps1'.
VERBOSE: Dot-sourcing the script file 'C:\Program Files\WindowsPowerShell\Modules\PoshRSJob\1.7.5.1\Scripts\TabExpansion.ps1'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PoshRSJob\1.7.5.1\PoshRSJob.psm1'.
WARNING: Start-RSJob.ps1: At C:\Program Files\WindowsPowerShell\Modules\PoshRSJob\1.7.5.1\Public\Start-RSJob.ps1:576 char:21
+                     [void]$RunspacePool.ThreadOptions = $ThreadOption ...
+                     ~~~~~~
[void] cannot be used as a parameter type, or on the left side of an assignment.
MVKozlov commented 5 years ago

ok, it not my commit, I fix it a bit later. and, please open issue in my repo because it not applicable here

kborowinski commented 5 years ago

@MVKozlov: I can't open issue in your repo, there is no Issue tab

MVKozlov commented 5 years ago

sorry, forget to enable it :)