improve performance of backfill avoid queuing more than 1 backfill call

This commit is contained in:
Sam 2016-11-25 12:33:10 +11:00
parent 3bec128f5f
commit 881eb373c5
1 changed files with 6 additions and 1 deletions

View File

@ -732,10 +732,15 @@ export default RestModel.extend({
this._excerpts = this._excerpts || [];
const stream = this.get('stream');
this._excerpts.loadNext = streamPosition;
if (this._excerpts.loading) {
return this._excerpts.loading.then(()=>{
if(!this._excerpts[stream[streamPosition]]) {
return this.backfillExcerpts(streamPosition);
if (this._excerpts.loadNext === streamPosition) {
return this.backfillExcerpts(streamPosition);
}
}
});
}