@@ -150,7 +150,7 @@ List.prototype._refresh = function () {
150150 var self = this
151151 var buckets = this . buckets
152152
153- return Promise . all ( this . _patterns . map ( function ( patternObject ) {
153+ var promise = Promise . map ( this . _patterns , function ( patternObject ) {
154154 var pattern = patternObject . pattern
155155
156156 if ( helper . isUrlAbsolute ( pattern ) ) {
@@ -167,7 +167,7 @@ List.prototype._refresh = function () {
167167 return
168168 }
169169
170- return Promise . all ( files . map ( function ( path ) {
170+ return Promise . map ( files , function ( path ) {
171171 if ( self . _isExcluded ( path ) ) {
172172 log . debug ( 'Excluded file "%s"' , path )
173173 return Promise . resolve ( )
@@ -185,7 +185,7 @@ List.prototype._refresh = function () {
185185 return self . _preprocess ( file ) . then ( function ( ) {
186186 return file
187187 } )
188- } ) )
188+ } )
189189 . then ( function ( files ) {
190190 files = _ . compact ( files )
191191
@@ -195,17 +195,17 @@ List.prototype._refresh = function () {
195195 buckets . set ( pattern , new Set ( files ) )
196196 }
197197 } )
198- } ) )
199- . cancellable ( )
198+ } )
200199 . then ( function ( ) {
200+ if ( self . _refreshing !== promise ) {
201+ return self . _refreshing
202+ }
201203 self . buckets = buckets
202204 self . _emitModified ( true )
203205 return self . files
204206 } )
205- . catch ( Promise . CancellationError , function ( ) {
206- // We were canceled so return the resolution of the new run
207- return self . _refreshing
208- } )
207+
208+ return promise
209209}
210210
211211// Public Interface
@@ -245,10 +245,6 @@ Object.defineProperty(List.prototype, 'files', {
245245// Returns a promise that is resolved when the refresh
246246// is completed.
247247List . prototype . refresh = function ( ) {
248- if ( this . _isRefreshing ( ) ) {
249- this . _refreshing . cancel ( )
250- }
251-
252248 this . _refreshing = this . _refresh ( )
253249 return this . _refreshing
254250}
0 commit comments