Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some negatives with the current approach (evented FS watcher)
Build loops are possible
If you forget to ignore something, its possible to get stuck in a
build loop, where the command outputs a file, which triggers a
rebuild, which outputs a file, which triggers...
CPU usage
Evented watchers aren't free. Larger the project, the more %CPU it
takes to just watch the FS
Wasted work
After everysave, a build is triggered - which isn't ideal as in most
cases one will save more than 1 file before tabbing over to the
browser. This leads to more wasted CPU spent rerunning commands on
every save.
New approach: Check FS on HTTP request.
Flipped the sequence. Previously:
-> FS Change
-> Pause Proxy
-> Rebuild
-> Unpause Proxy
New sequence:
-> Request comes in
-> Pause Proxy
-> Check for FS changes
-> If changes exist, rebuild
-> Unpause Proxy
This has several advantages:
The obvious downside is that now each request needs to check the FS for
changes.
However, with these changes it is possible to chain multiple
tychus
'stogether. When using that feature, a
--wait
flag has been added. Usingthat flag will tell tychus to block until the user specified command
finishes. This command will most often be some script or quick series of
commands and not something blocking like a webserver.