-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Whenever we use mkdocs serve --livereload
, the livereload server blocks, as MkDocs waits for changes to files that can be reported back to the browser. This technique is known as long polling, and albeit we now have wide support for websockets which are a superior solution, it's a perfectly fine implementation for livereload functionality.
Blocking is implemented here:
mkdocs/mkdocs/livereload/__init__.py
Line 262 in 347c3a9
self._epoch_cond.wait_for(condition, timeout=self.poll_response_timeout) |
However, sometimes when I navigate the site while working on it, MkDocs gets stuck in this condition and waits for changes to files. There are three ways to unblock it:
- Change and save a file, so MkDocs rebuilds it and returns it to the browser
- Press ESC in the browser to cancel the
/livereload
request - Wait for a minute until it times out
I'm not very familiar with the livereload implementation, but the problem seems to be that the server is occupied with waiting for the livereload request to finish hitting one of the conditions mentioned above, which prohibits the navigation from happening – see the loading indicator after navigating for the third time:
Ohne.Titel.mov
My testing shows that this problem can be solved by cancelling the pending /livereload
request before navigation.