Merge pull request #8193 from ryanpetrello/ws-broadcast-limited

add a few additional optimizations to the callback receiver

Reviewed-by: Shane McDonald <me@shanemcd.com>
             https://github.com/shanemcd
This commit is contained in:
softwarefactory-project-zuul[bot]
2020-09-23 14:58:41 +00:00
committed by GitHub
4 changed files with 37 additions and 5 deletions

View File

@@ -119,6 +119,10 @@ function OutputStream ($q) {
this.counters.ready = ready;
this.counters.used = used;
this.counters.missing = missing;
if (!window.liveUpdates) {
this.counters.ready = event.counter;
}
};
this.bufferEmpty = threshold => {
@@ -141,6 +145,10 @@ function OutputStream ($q) {
const { total } = this.counters;
const readyCount = this.getReadyCount();
if (!window.liveUpdates) {
return true;
}
if (readyCount <= 0) {
return false;
}

View File

@@ -51,7 +51,13 @@ describe('Output | StreamService', () => {
});
describe('isReadyToRender', () => {
it("it's never ready to render unless the result of getReadyCount is greater than 0", () => {
it("it's never ready to render when live updates are enabled unless the result of getReadyCount is greater than 0", () => {
delete window.liveUpdates;
Object.defineProperty(window, 'liveUpdates', {
value: true,
writable: false
});
const params = [
[-1, false],
[0, false],