Closed peterjmag closed 9 years ago
graceful-fs seems to fix it.
Without graceful-fs
peterjmag@peters-imac ~/tmp/css-metrics/flattened
$ parker . | head -3
PARKER-JS
Total Stylesheets: 244
Total Stylesheet Size: 787343
With graceful-fs
peterjmag@peters-imac ~/git/parker (git::use-graceful-fs)
$ npm link
/Users/peterjmag/.nvm/v0.10.31/bin/parker -> /Users/peterjmag/.nvm/v0.10.31/lib/node_modules/parker/parker.js
/Users/peterjmag/.nvm/v0.10.31/lib/node_modules/parker -> /Users/peterjmag/git/parker
peterjmag@peters-imac ~/git/parker (git::use-graceful-fs)
$ parker ~/tmp/css-metrics/flattened/ | head -3
PARKER-JS
Total Stylesheets: 289
Total Stylesheet Size: 1861232
When running Parker on our styles directory (which is admittedly rather large), I get a discrepancy between the "Total Stylesheets" metric and the actual count of CSS files.
(Note that I've flattened the directory for this test case in order to rule out directory depth issues.)
In this case, it's missing 45 files. Interestingly, this number is very close to the number of CSS files in this directory that are 10KB or larger.
If I remove, say, 60 files at random from the directory and run Parker again, I get accurate results:
Digging a bit further, it looks like there are some file read errors that are being silently ignored. After adding some quick and dirty logging (see my patch at https://gist.github.com/peterjmag/5ff386c821a6612c99ce), I get errors like these:
Perhaps Parker's just reading too many files at once? Some googling for "node EMFILE 20" led me to graceful-fs as a potential solution, so I'll try it out and submit a pull request shortly.