My Grunt watch task is experiencing significant delays between detecting a file change and starting to work.
Output similar to the following is frequently seen:
>> File "src/static/app/brandManager/addChannel.html" changed.
Running "html2js:main" (html2js) task
Successfully converted 13 html templates to js.
Done, without errors.
Execution Time (2014-02-11 01:38:27 UTC)
loading tasks 101ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 17%
html2js:main 495ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 83%
Total 597ms
... Reload src/static/app/brandManager/addChannel.html ...
Completed in 14.469s at Tue Feb 11 2014 12:38:28 GMT+1100 (EST) - Waiting...
Although the actual work only took 597ms
, the total task ran for 14.469s
.
Below is the relevant snippet from my Gruntfile:
src: {
js: ['src/static/app/**/*.js', '!src/static/app/**/*.spec.js'],
},
watch: {
js: {
files: ['<%= src.js %>'],
tasks: ['fileblocks','newer:jshint:all'],
options: {
livereload: false
}
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'<%= src.html %>',
'.tmp/styles/{,*/}*.css',
'<%= src.assets %>'
]
}
}
Regardless of the watch target invoked, there is consistently a delay of varying lengths, ranging from 5s to as long as 60s (though typically around 15-20s).
This delay is negatively impacting my workflow. How can I troubleshoot the cause?
Edit:
The number of files being watched is not insignificant but also not extensive:
--- static/app ‹master› find -f . | wc -l
>> 51