Use 'watchgod' module instead of 'watchdog'
See original GitHub issueI’m just starting to use Lektor but i noticed that it uses the watchdog
module and one of the first comments that i saw at the quickstart tutorial was:
When I run lektor server I get OSError: inotify watch limit reached
I ran into that myself and thus i know what it is and that it’s related to watchdog
but a lot of beginners probably don’t know. Instead of using separate approaches for each OS to watch for file-changes, i think that using the watchgod module could be a better and simpler solution.
Maybe it’s a good idea to at least check the module out and see if it fits better than the overly complex watchdog implementation.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
installed watchdog module .but i am not access the module
Use PyCharm to write code in python It helps to solve module errors by itself It will show hint button when there is...
Read more >Monitoring your File System using watchdog - Medium
Learn how to monitor any changes to a filesystem on a local or remote machine and take some action using watchdog. You will...
Read more >External Watchgod Monitor S32K148 - NXP Community
I have some concerns regarding FS32K148 EWM Module: Is it ok to use the internal redundant watchdog EWM to generate the reset signal...
Read more >encode/community - Gitter
Crazy indeed eg the module path and error message here don't even match: ... watchgod uses polling, but it seems like it's much...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hitting the inotify limits is a system problem, not a Lektor problem — sometimes even
tail -f
won’t run in this case — but it would be good if Lektor would degrade gracefully when this happens.The
watchdog
distribution provides several different types of “Observers” that can be used to watch for file changes. On Linux, the default observer isInotifyObserver
. There are other observers which are used on different OSes, but watchdog also provides aPollingObserver
, which — while not as efficient as the other observers — should work anywhere.From looking at the Lektor code, it appears that Lektor does not catch exceptions when creating the default (
InotifyObserver
on Linux) observer, so if that fails the server just craps out.We should catch errors when creating the default observer, report them with a big warning, and then fall back to using
PollingObserver
.Yes, that error sounds like it is related to file watching. Does it crash the server or does it just show this error message and work as expected?
I understand that the “one size fits all” approach of watchgod sounds appealing, but I don’t think that it would be a good choice for Lektor. Watching for file-changes is inherently platform-specific (by using inotify, fsevents, etc., which watchdog does) or inefficient (by using polling, which watchgod and which is also offered by watchdog). Also, after having looked rather dead for a while, the watchdog repo has gotten more active recently and there’s frequent releases, so I think that’s also not an argument against watchdog anymore.