-
-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic module or function loading across runspaces #1494
Comments
Is Restart-PodeServer too slow for your need? |
@mdaneri yeah it’s way too slow unfortunately. Same goes for having Pode watch files and restart on change. It makes for quite a painful development process. That’s why dot sourcing route logic is so nice, you get to see changes reflected instantly without server restart. Again not something I’d do in Prod but for quick iterations in dev it’s perfect. Now I need to figure out a way to do this with dot-sourced functions and imported modules across runspaces. |
You're right that those functions aren't really built for this use case. Technically dot-sourcing them in I have an idea for I'll test out the |
Hey @Badgerati that sounds great! Thanks for looking into it…and can’t wait for the next release. |
@Badgerati congrats on the 2.12 release, I'm using it now and so far so good! Have you been able to test out the monitor idea yet? |
Question
Hey @Badgerati - it's been awhile! Still loving using Pode. Wondering if you've run into this or have any ideas?
I'm trying to dynamically reload PowerShell modules/functions at runtime to avoid server restarts. Trying a middleware approach using
Use-PodeScript
fails with a null reference exception, for example:Up to this point, I've been using
Use-PodeFolder -DefaultPath $config.Paths.Functions
inmain.ps1
, but this only loads functions once across runspaces, requiring server restart to apply changes each time a function is updated. This takes on average about 10-12 seconds per restart, which creates a slow feedback loop. Related....I've managed to accomplish a similar "hot reloading" behavior with my routes by dot-sourcing route logic in (good for dev, probably not such a great practice in Prod), but the same thing isn't working here since the key difference is that I need current function definitions across all runspaces and it seemsUse-PodeFolder
andUse-PodeScript
andImport-PodeModule
aren't designed to support that.Are there any ways around this to effectively reload function definitions across all runspaces without server restart (perhaps using middleware or some other approach)?
The text was updated successfully, but these errors were encountered: