-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
serve: double reload on backup files deletion #383
Comments
Hi @dns2utf8 thanks for the bug report. |
Another way to solve this would could be the 404 page. If it had code included for may displaying the index or detect the page beeing served (maybe again). |
Maybe we could add a command line argument to blacklist certain patterns of files, would that help? |
What if mdbook were to ignore all changes coming from files marked by the |
@dns2utf8 could you look on this PR https://github.com/azerupi/mdBook/pull/427? It solves multiple reloads on my system with vim (using notify crates builtin event aggregation logic which we have circumvented so far). It might not solve your case yet though. |
Release 0.0.24 includes the fix from @budziq. |
@azerupi I've checked it against kate today. The situation is better but not fixed. Kate emmits writes to tempfiles on each edit. This code at least deduplicates the events but you get the write notifies after each few edits which is as expected. Imho it its quite a nice side effect (you get live render preview with not too many reloads without need to save). But if someone thinks we should completely ignore the temp files we could use ignore crate |
Happy new year everybody. With the latest 0.1.1 release this behavior has become more intrusive. Even though I have this ignore file the reloads get triggerd while I type.
On my system the actual file does not change while typing, so I get no live preview. The edits go into the |
I'm looking through the notify docs and I don't know if you can give it some sort of ignore pattern. You can unset specific paths, but I'm not sure whether it'll keep ignoring a file once it's been deleted.
I don't think we pay any attention to your |
I did some work with the |
@rustbot label +C-bug +Command-serve +Command-watch +S-Duplicate See #2102 (comment) |
See rust-lang#2102 (comment) for explanation on this Closes rust-lang#2102, rust-lang#2035, rust-lang#383 and rust-lang#1441
See rust-lang#2102 (comment) for explanation on this Closes rust-lang#2102, rust-lang#2035, rust-lang#383 and rust-lang#1441
The problem arises when working with an editor like Kate which keeps your current edits in a swap file.
When saving the swapped contents to the real file an event occurs and triggers the rebuild of the book.
While the book is building another event occurs because the swap file is deleted.
On my machine this creates a race.
Sometimes the second thread is fast enough to delete the folder before the first finishes working and nothing happens.
But around 50% of the time the deletion happens right after the first build finished. This means the browser will receive a reload command at the same time as the second thread starts deleting the files. In that case the browser gets a 404 and the reload function is dead. A manual reload is required now.
I see a probable solution by triggering the rebuild with some delay on the server.
Delaying the client is also possible but the client would either have to poll the server for the file or delay a fixed amount of time.
What do you think?
The text was updated successfully, but these errors were encountered: