Grunt watch detects file changes only after 5 seconds with Vagrant and NFS

自作多情 提交于 2019-11-29 03:33:36

问题


Grunt watch (grunt-contrib-watch) is used to trigger reload of web app in browser. However, it is slow to notice file changes when running in a Vagrant virtual machine using NFS for synced folders. Changing a file triggers a reload only after about 5 seconds although it is expected to happen almost instantly. Why is grunt watch so slow to detect changes? Is there any way to make it faster?

With VirtualBox synced folders grunt watch detects file changes almost instantly. However, as VirtualBox synced folders are unacceptably slow for certain other operations on large amounts of files it is unfortunately not an option to revert back to it in this case.


回答1:


Try these mount options in your Vagrantfile:

type: "nfs", mount_options: ['actimeo=1']

This will greatly reduce the NFS file attribute caching timeout. I was having similar troubles, seeing large delays with Vagrant/NFS when waiting for gulp and Django server reloads. This fixed it; file changes are now detected instantly.



来源:https://stackoverflow.com/questions/27035702/grunt-watch-detects-file-changes-only-after-5-seconds-with-vagrant-and-nfs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!