Skip to content

Commit f5c252f

Browse files
author
Ruben Bridgewater
committed
feat(file-list): Upgrade bluebird to v.3
1 parent e81c3c7 commit f5c252f

2 files changed

Lines changed: 10 additions & 14 deletions

File tree

lib/file-list.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
247247
List.prototype.refresh = function () {
248-
if (this._isRefreshing()) {
249-
this._refreshing.cancel()
250-
}
251-
252248
this._refreshing = this._refresh()
253249
return this._refreshing
254250
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@
262262
],
263263
"dependencies": {
264264
"batch": "^0.5.3",
265-
"bluebird": "^2.9.27",
265+
"bluebird": "^3.3.0",
266266
"body-parser": "^1.12.4",
267267
"chokidar": "^1.4.1",
268268
"colors": "^1.1.0",

0 commit comments

Comments
 (0)