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

Watch the config folder for file changes #26

Closed
nicoverbruggen opened this issue Mar 30, 2021 · 2 comments
Closed

Watch the config folder for file changes #26

nicoverbruggen opened this issue Mar 30, 2021 · 2 comments
Assignees
Labels
fixed in upcoming release Fixed in the upcoming release!
Milestone

Comments

@nicoverbruggen
Copy link
Owner

nicoverbruggen commented Mar 30, 2021

Currently, there's a manual refresh option in v3.3 (added via #24) but in the future I'd like to watch the config folder for file changes, so that when a file in the config folder changes, PHP Monitor automatically reloads the PHP installation information.

Important note: The folder watcher should stop watching when the PHP version changes, and start watching again. It should do this without leaking memory, so I should be careful about retain cycles here.

@nicoverbruggen nicoverbruggen added the enhancement New feature or request. label Mar 30, 2021
@nicoverbruggen nicoverbruggen added this to the v4.0 milestone Mar 30, 2021
@nicoverbruggen nicoverbruggen self-assigned this Mar 30, 2021
nicoverbruggen added a commit that referenced this issue Mar 30, 2021
Current caveats:

* Config watcher does not adapt to new files in conf.d (it should
  in the future adapt to new files)
* Config watcher does not adapt to removed files
@nicoverbruggen
Copy link
Owner Author

nicoverbruggen commented Mar 30, 2021

I've got a preliminary version of this up and running. Was a bit interesting to figure out, but if you're into the deets here's how it works so far:

  • The config folder is located
  • The following paths are checked: /php.ini, /conf.d and watchers are created for these
  • The contents of conf.d is checked; for each file that ends with .ini, an additional watcher is set up
  • Whenever a watcher reports a file change, PHP Monitor reloads

So far, it works great, but the watchers don't dynamically update based on new files. So if you add a new .ini file, the watcher will trigger once, but subsequent changes to that .ini file aren't tracked.

Also, if you install an extension this watcher event may trigger like 20 times in < 1 second, so that needs to be debounced as well. Otherwise, it attempts to load PHP info that many times as well, blocking the main thread.

More on that next time I work on this.

@nicoverbruggen
Copy link
Owner Author

nicoverbruggen commented Nov 13, 2021

Planned for 4.2 or later, since this is a big change. Not sure I'll have time to polish this by the end of the year. It's gonna depend :)

@nicoverbruggen nicoverbruggen modified the milestones: v4.1, v4.2 Dec 5, 2021
@nicoverbruggen nicoverbruggen added the fixed in upcoming release Fixed in the upcoming release! label Dec 19, 2021
@nicoverbruggen nicoverbruggen removed the enhancement New feature or request. label Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in upcoming release Fixed in the upcoming release!
Projects
None yet
Development

No branches or pull requests

1 participant