Skip to content
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

Frequent UnmarshalCaddyfile Calls with --watch Flag #6790

Open
JasonLovesDoggo opened this issue Jan 17, 2025 · 1 comment
Open

Frequent UnmarshalCaddyfile Calls with --watch Flag #6790

JasonLovesDoggo opened this issue Jan 17, 2025 · 1 comment

Comments

@JasonLovesDoggo
Copy link

When running Caddy with the --watch flag, the UnmarshalCaddyfile method is called frequently on all plugins, even when there are no changes to the configuration file. This leads to unnecessary parsing and processing, impacting performance.

Steps to Reproduce:

  1. Create a custom Caddy plugin with logging in UnmarshalCaddyfile.
  2. Configure Caddy to use this plugin in the Caddyfile.
  3. Run Caddy with the command: caddy run --config Caddyfile --watch.
  4. Observe the logs showing repeated calls to UnmarshalCaddyfile without configuration changes.

Expected Behavior:

UnmarshalCaddyfile should only be called when there are actual changes to the configuration file.

Actual Behavior:

The method is called every second, even when no changes occur.

note: This is similar to #5538 however it's due to a different underlying issue

JasonLovesDoggo added a commit to JasonLovesDoggo/caddy that referenced this issue Jan 17, 2025
Reload the Caddy config when the raw content of the
Caddyfile changes, rather than only when the parsed
configuration changes. This ensures that changes to
comments or other non-functional parts of the
Caddyfile still trigger a reload.
@francislavoie
Copy link
Member

--watch isn't meant to be performant. It should only be used during development only. It being performant isn't really a goal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants