mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
return promises correctly, remove stop from queue complete, fix pending test, use sinon autorelease
This commit is contained in:
parent
b6389b6b15
commit
2da24fc27c
2 changed files with 15 additions and 12 deletions
|
@ -47,17 +47,19 @@ define(function (require) {
|
|||
self._setRequestHandlers(opts);
|
||||
|
||||
return Promise.try(function () {
|
||||
self._extractQueue(opts.direction);
|
||||
return self._extractQueue(opts.direction);
|
||||
})
|
||||
.then(function () {
|
||||
req = self._createRequest();
|
||||
return req;
|
||||
})
|
||||
.then(function (req) {
|
||||
self._startRequest(req);
|
||||
return self._startRequest(req);
|
||||
})
|
||||
.then(function () {
|
||||
self._executeRequest(req, opts);
|
||||
return self._executeRequest(req, opts);
|
||||
}).then(function () {
|
||||
return self._stopRequest();
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -87,7 +89,9 @@ define(function (require) {
|
|||
|
||||
// stop any existing segmentedFetches
|
||||
if (self.running) {
|
||||
p = p.then(self._stopRequest);
|
||||
p = p.then(function () {
|
||||
self._stopRequest();
|
||||
});
|
||||
}
|
||||
|
||||
return p.then(function () {
|
||||
|
@ -268,12 +272,10 @@ define(function (require) {
|
|||
};
|
||||
|
||||
segmentedFetch.prototype._processQueueComplete = function (req, loopCount) {
|
||||
return this._stopRequest().then(function () {
|
||||
req.complete = true;
|
||||
req.ms = req.moment.diff() * -1;
|
||||
req.source.activeFetchCount -= 1;
|
||||
return (loopCount + 1);
|
||||
});
|
||||
req.complete = true;
|
||||
req.ms = req.moment.diff() * -1;
|
||||
req.source.activeFetchCount -= 1;
|
||||
return (loopCount + 1);
|
||||
};
|
||||
|
||||
function mergeRequestStats(requestStats, resp) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
define(function (require) {
|
||||
var sinon = require('sinon/sinon');
|
||||
var sinon = require('test_utils/auto_release_sinon');
|
||||
var Promise = require('bluebird');
|
||||
|
||||
var SegmentedFetch;
|
||||
|
@ -157,10 +157,11 @@ define(function (require) {
|
|||
|
||||
it('should abort the existing fetch');
|
||||
|
||||
it('should abort the es promise', function () {
|
||||
|
||||
});
|
||||
|
||||
it('should abort the es promise');
|
||||
|
||||
it('should clear the notification', function () {
|
||||
var spy = segmentedFetch.notifyEvent = sinon.spy();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue