Skip to content

Commit

Permalink
fix(MesosStateStore): adjust the backoff strategy
Browse files Browse the repository at this point in the history
Adjust the backoff strategy to allow _unlimitted_ retries, reduce the start delay and limit the delay to 5 seconds.

The adjusted strategy should make the Mesos data stream more resilient to connection issues and basically falls back to polling for changes in cases where chunked streaming doesn't work.

This change also improves the perceived performance as delaying the first retry longer than 500ms results in users thinking that nothing is happening at all.

Closes DCOS-38400
  • Loading branch information
Orlando Hohmeier authored and Fabs committed Jul 2, 2018
1 parent cc2a96b commit 1ed8544
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/js/stores/MesosStateStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import container from "../container";
import * as mesosStreamParsers from "./MesosStream/parsers";

const MAX_RETRIES = 5;
const RETRY_DELAY = 5000;
const RETRY_DELAY = 500;
const MAX_RETRY_DELAY = 5000;
const METHODS_TO_BIND = ["setState", "onStreamData", "onStreamError"];

class MesosStateStore extends GetSetBaseStore {
Expand Down Expand Up @@ -106,7 +107,9 @@ class MesosStateStore extends GetSetBaseStore {
this.stream = waitStream
.concat(eventTriggerStream)
.sampleTime(Config.getRefreshRate() * 0.5)
.retryWhen(linearBackoff(MAX_RETRIES, RETRY_DELAY))
.retryWhen(
linearBackoff(Number.MAX_SAFE_INTEGER, RETRY_DELAY, MAX_RETRY_DELAY)
)
.subscribe(
() => Promise.resolve().then(this.onStreamData),
this.onStreamError
Expand Down

0 comments on commit 1ed8544

Please sign in to comment.