Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#435: ability to set number of concurrent schedules
- Loading branch information
Showing
6 changed files
with
69 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
$path = Split-Path -Parent -Path (Split-Path -Parent -Path $MyInvocation.MyCommand.Path) | ||
Import-Module "$($path)/src/Pode.psm1" -Force -ErrorAction Stop | ||
|
||
# or just: | ||
# Import-Module Pode | ||
|
||
# create a server, and start listening on port 8085 | ||
Start-PodeServer { | ||
|
||
# listen on localhost:8085 | ||
Add-PodeEndpoint -Address * -Port 8085 -Protocol Http | ||
|
||
# add lots of schedules that each sleep for a while | ||
1..30 | ForEach-Object { | ||
Add-PodeSchedule -Name "Schedule_$($_)" -Cron '@minutely' -ArgumentList @{ ID = $_ } -ScriptBlock { | ||
param($ID) | ||
|
||
$seconds = (Get-Random -Minimum 5 -Maximum 40) | ||
Start-Sleep -Seconds $seconds | ||
"ID: $($ID) [$($seconds)]" | Out-PodeHost | ||
} | ||
} | ||
|
||
Set-PodeScheduleConcurrency -Maximum 30 | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters