Skip to content

Commit

Permalink
fix: Always set the SSE URL - ignore empty strings (#261)
Browse files Browse the repository at this point in the history
Always set the SSE URL
  • Loading branch information
JamieSinn authored Jun 13, 2024
1 parent fec9e3f commit 38fda18
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions configmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (e *EnvironmentConfigManager) ssePollingManager() {

if url, ok := eventData["sseUrl"]; ok && e.options.EnableBetaRealtimeUpdates && e.sseManager != nil {
// Reconnect SSE
if e.sseManager.url != url || !e.sseManager.Connected.Load() {
if url != "" && (e.sseManager.url != url || !e.sseManager.Connected.Load()) {
err := e.StartSSE(url)
if err != nil {
e.InternalClientEvents <- api.ClientEvent{
Expand Down Expand Up @@ -200,6 +200,7 @@ func (e *EnvironmentConfigManager) initialFetch() error {
}

func (e *EnvironmentConfigManager) fetchConfig(numRetriesRemaining int, minimumLastModified ...time.Time) (err error) {
util.Debugf("Fetching config. Retries remaining: %d\n", numRetriesRemaining)
defer func() {
if r := recover(); r != nil {
// get the stack trace and potentially log it here
Expand Down Expand Up @@ -349,7 +350,7 @@ func (e *EnvironmentConfigManager) setConfig(config []byte, eTag, rayId, lastMod
}
if e.minimalConfig != nil && e.minimalConfig.SSE != nil {
sseUrl := fmt.Sprintf("%s%s", e.minimalConfig.SSE.Hostname, e.minimalConfig.SSE.Path)
if e.sseManager != nil && e.sseManager.url != sseUrl {
if e.sseManager != nil {
configUpdatedEvent.EventData.(map[string]string)["sseUrl"] = sseUrl
}
}
Expand Down

0 comments on commit 38fda18

Please sign in to comment.