Open HeyItsGilbert opened 1 month ago
You beat me to it @mdaneri! lol
I think it's done. The only one that are not named are the user tasks and schedule
I was actually hoping those would be part of them, but the helper should suffice.
you can assign a name. I wrote this on the documentation
In Pode, internal runspaces are automatically assigned distinct names. This naming convention helps in identifying and managing these runspaces efficiently during debugging and monitoring. However, this is not the case for runspaces created by user tasks and schedules (excluding AsyncTask). These user-created runspaces typically have names in the Runspace<number>
format, which can make it challenging to distinguish between different runspaces.
To provide clarity and better manageability, you can set custom names for runspaces within your Pode tasks or schedules. This can be achieved using the Set-PodeCurrentRunspaceName
cmdlet. By assigning meaningful names to your runspaces, you can easily identify and work with them, especially during debugging or performance monitoring.
Another useful cmdlet is Get-PodeCurrentRunspaceName
, which retrieves the current runspace's name. This can be helpful if you need to log or display the runspace name dynamically.
Here is an example demonstrating how to set a custom name for a runspace in a Pode task:
Add-PodeTask -Name 'Test2' -ScriptBlock {
param($value)
# Set a custom name for the current runspace
Set-PodeCurrentRunspaceName -Name 'Test2'
Start-Sleep -Seconds 10
"A $($value) is never late, it arrives exactly when it means to" | Out-Default
}
In this example, the Set-PodeCurrentRunspaceName
cmdlet is used to assign the name 'Test2' to the runspace executing the task. This makes it easier to identify the runspace in logs or during debugging sessions.
Describe the Change
When inspecting a Pode server we often see several runspaces in different states. I know there are several runspaces for schedules and route listenings. It would be useful if the runspaces where named.
Currently
Enter-PSHostProcess -Id <pid>
Get-Runspace
If we had runspaces that were labeled for schedule tasks that may help troubleshooting, etc.