- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
calling Load(config) from modules #4464
Comments
You're right, we haven't really documented how to use dynamic config loading. There's an explanation in the PR where it was introduced though, see the 3rd part #3994 |
thanks. the linked PR doesnt explain if Load can be called at any point tho, as it is going to happen with a dynamic config. |
Right, the other part is #4246 which added periodically pulling the config from the loader. So you could implement your own loader (a module in the namespace |
which would only allow polling instead of loading it on change tho. |
The issue with that is the risk of deadlocks, cause the thing making the request will try to get shut down by the config loader which is swapping out the old config with the new, but if it can't shut down the old config (because there's still a pending request), it'll never be able to load the new config. But yeah, I'd suggest configuring some low polling rate (50ms or 100ms should be more than frequent enough) and do a quick check to see if you should attempt to load a new one or not. Noticed an issue with that idea though, /cc @mholt, the |
@francislavoie How about instead we allow returning Would this be helpful / solve the problem? |
ah, hm this is awkward. I found some other issues with async loading but don't remember since we ended up not using Caddy. I think we should just close this. |
the website mentions dynamic configuration but i haven't found any plugin that dynamically loads configs, and no documentation.
Is it ok to call Load() from a module?
caddy/caddy.go
Line 102 in e7457b4
how do we avoid the loop when caddy instantiates the module after reloading the config?
The text was updated successfully, but these errors were encountered: