File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,8 @@ MusicLibrary.prototype.clean = function (opts, cb) {
142142 var levelBatch = new LevelBatch ( this . db )
143143 var paralleLevelBatch = parallel ( levelBatch , opts . parallel || 10 )
144144
145+ var paths = this . paths
146+
145147 function operation ( chunk ) {
146148 var key = keyFn ( chunk . value . filepath )
147149 return {
@@ -151,12 +153,20 @@ MusicLibrary.prototype.clean = function (opts, cb) {
151153 }
152154
153155 function fsStat ( chunk , enc , cb ) {
156+ if ( ! paths . some ( areIncluded ) ) {
157+ this . push ( chunk )
158+ return cb ( )
159+ }
154160 fs . stat ( chunk . value . filepath , pushMissing . bind ( this ) )
155161
156162 function pushMissing ( err , value ) {
157163 if ( err ) this . push ( chunk )
158164 return cb ( )
159165 }
166+
167+ function areIncluded ( path ) {
168+ return path === chunk . value . root
169+ }
160170 }
161171
162172 return pump (
You can’t perform that action at this time.
0 commit comments