Pode icon indicating copy to clipboard operation
Pode copied to clipboard

Why call Invoke-PodeTask so slowly ?

Open noname007 opened this issue 2 years ago • 3 comments

Question

A clear and concise description of your question.

    Add-PodeTask -Name "Test" -ScriptBlock {
        Write-Host "11111111111111"
        Start-Sleep -Seconds 5
        Write-Host "222222"

    }

    Add-PodeRoute -Method Get -Path '/test' -ScriptBlock {

        try {
            Write-Host "---------------------------"
            for ($i = 0; $i -lt 30; $i++) {
                Invoke-PodeTask -Name "Test"
            }
        }
        catch {
            Write-Host $_.Exception.Message
            Write-Host $_.ScriptStackTrace
        }

    }

noname007 avatar Feb 06 '23 09:02 noname007

powershell itsself question ? https://github.com/PowerShell/PowerShell/issues/11826 ?

noname007 avatar Feb 06 '23 09:02 noname007

did you set Set-PodeTaskConcurrency?

ili101 avatar Feb 06 '23 12:02 ili101

Set-PodeTaskConcurrency 30 . Sorry, i am a newbies. Maybe casused by Search-Mailbox , I want to delete a batch of emails at exchagne online. i fetch all emails then put every email info into the pod-task to delete using Search-Mailbox.

noname007 avatar Feb 06 '23 14:02 noname007