From 881eb373c5f846eba21b143838285722c2531b06 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 25 Nov 2016 12:33:10 +1100 Subject: [PATCH] improve performance of backfill avoid queuing more than 1 backfill call --- app/assets/javascripts/discourse/models/post-stream.js.es6 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/models/post-stream.js.es6 b/app/assets/javascripts/discourse/models/post-stream.js.es6 index 7db4ea2ce02..a711303f228 100644 --- a/app/assets/javascripts/discourse/models/post-stream.js.es6 +++ b/app/assets/javascripts/discourse/models/post-stream.js.es6 @@ -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); + } } }); }