-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add --timeout option to reload after website has fully built #3
Comments
This is still a problem. I wanted to use httpwatcher on RaspberryPI and since the files are stored on sdcard and any edit and save of the file with vim takes some time (vim probably first removes the original file and then renames the working copy of the file .swp), the httpwatcher will error with 404. |
Sounds like a good feature to add. Does any one of you want to create a PR, or should I take this upon myself? @blackdaemon @Evidlo |
@jobveldhuis Go ahead. I actually implemented this to a degree a while ago, but the files are gone now. |
@Evidlo Please check the latest version of the dev branch and see whether or not this is the use case you had in mind. You are now able to use: |
@jobveldhuis The behavior I'm proposing is just subtly different from a simple reload interval. I came up with a contrived example to show how httpwatcher can actually miss file change events if implemented this way: Current behavior (with
As you can see, the last two file change events are not picked up by httpwatcher. If we instead wait for a period of no activity before reloading, we can catch these events: Proposed behavior (with
So basically, a file change event should start/reset a timer which then triggers the page reload. I think this would be implemented with tornado's call_later function with a callback to trigger the page reload. |
So you are proposing a delay of some kind? Sounds good, I will look into this tonight! |
I'm using httpwatcher to automatically reload my browser while authoring content with a static website generator. Unfortunately, the website generator does a full rebuild of the website when changes are detected, which can cause httpwatcher to trigger a reload before the generator is finished rebuilding or even trigger httpwatcher multiple times in one rebuild.
This could be solved pretty simply if httpwatcher had a
--timeout N
option whereby anN
millisecond countdown is started when a change is detected before httpwatcher starts to reload the page.Is this equivalent to
watcher_inverval
? In any case, it's not yet available as a flag.The text was updated successfully, but these errors were encountered: