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

Use FS inotify instead of polling #7

Open
er1z opened this issue Aug 19, 2020 · 2 comments
Open

Use FS inotify instead of polling #7

er1z opened this issue Aug 19, 2020 · 2 comments

Comments

@er1z
Copy link

er1z commented Aug 19, 2020

Do you mind introducing FS watching based on inotify? It'll decrease CPU usage significantly.

@COil
Copy link
Member

COil commented Aug 19, 2020

Hi @er1z,

Well, I am open to all suggestions. Are you familiar with inotify and how it could be implemented in this project?

@er1z
Copy link
Author

er1z commented Aug 19, 2020

I'm completely not into golang but found this module: https://github.com/fsnotify/fsnotify

Currently, you poll the specified paths every N milliseconds. Using the library above, you could completely give up on that option (sleep) because an event is being raised whenever anything is being changed under specified directory. Then, you can compare the path of changed file against paths collection and if it exists — fire cache warmup.

Our CPUs will scream „thanks” because checking all files every time will be irrelevant.

edit: https://godoc.org/github.com/rjeczalik/notify this one looks like a more mature.

@COil COil changed the title [idea] use FS inotify instead of polling [optimisation] use FS inotify instead of polling Aug 29, 2020
@COil COil changed the title [optimisation] use FS inotify instead of polling Use FS inotify instead of polling Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants