Skip to content

Commit

Permalink
Update configuration documentation to describe the usage of STREAMING…
Browse files Browse the repository at this point in the history
…_DELAY_SECONDS
  • Loading branch information
moshegood committed Feb 11, 2024
1 parent 908e57d commit 52ff6a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ For **Duration** settings, the value should be be an integer followed by `ms`, `
| `logLevel` | `LOG_LEVEL` | String | `info` | Should be `debug`, `info`, `warn`, `error`, or `none`. To learn more, read [Logging](./logging.md). |
| `bigSegmentsStaleAsDegraded` | `BIG_SEGMENTS_STALE_AS_DEGRADED` | Boolean | `false` | Indicates if environments should be considered degraded if Big Segments are not fully synchronized. |
| `bigSegmentsStaleThreshold` | `BIG_SEGMENTS_STALE_THRESHOLD` | Duration | `5m` | Indicates how long until Big Segments should be considered stale. |
| n/a | `STREAMING_MIN_DELAY` | Duration | `0` | The minimum latency of responding to a new client connection. Used only in proxy mode for streaming clients. Useful for reducing memory when under heavy load, as many clients can share a single data fetch. |

_(1)_ The default values for `streamUri`, `baseUri`, and `clientSideBaseUri` are `https://stream.launchdarkly.com`, `https://sdk.launchdarkly.com`, and `https://clientsdk.launchdarkly.com`, respectively. You should never need to change these URIs unless you are either using a special instance of the LaunchDarkly service, in which case Support will tell you how to set them, or you are accessing LaunchDarkly using a reverse proxy or some other mechanism that rewrites URLs.

Expand Down
11 changes: 5 additions & 6 deletions internal/streams/stream_provider_server_side.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package streams
import (
"net/http"
"os"
"strconv"
"sync"
"time"

Expand Down Expand Up @@ -134,12 +133,12 @@ func (r *serverSideEnvStreamRepository) getReplayEvent() (eventsource.Event, err
event := MakeServerSidePutEvent(allData)
// So we sleep for a bit to allow a bunch of concurrent calls to
// all make use of this same flightGroup.
delayS := os.Getenv("LD_STREAMING_DELAY_SECONDS")
if delay, err := strconv.Atoi(delayS); err == nil {
if delay > 0 && delay <= 60 {
time.Sleep(time.Duration(delay)*time.Second - time.Since(start))
delayS, has := os.LookupEnv("STREAMING_MIN_DELAY")
if has {
if delay, err := time.ParseDuration(delayS); err == nil {
time.Sleep(delay - time.Since(start))
} else {
r.loggers.Warnf("Ignoring invalid value for LD_STREAMING_DELAY_SECONDS: %s", delayS)
r.loggers.Warnf("Ignoring invalid STREAMING_MIN_DELAY: %s\n", delayS)
}
}

Expand Down

0 comments on commit 52ff6a5

Please sign in to comment.