Skip to content

Commit

Permalink
Fix race condition sitemap vs events (openhab#3639)
Browse files Browse the repository at this point in the history
Fixes openhab#3637 

Signed-off-by: Arne Seime <[email protected]>
  • Loading branch information
seime authored Apr 11, 2024
1 parent 01dad85 commit b6c3b63
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,14 @@ class PageConnectionHolderFragment : Fragment(), CoroutineScope {
callback.onWidgetUpdated(url, updatedWidget)
return
}
} else if (lastWidgetList != null) {
// Either we didn't find the widget (possibly because the server didn't give us invisible widgets),
// or we couldn't update it because we couldn't trust the data, so reload the page.
// If we didn't have a widget list yet, simply ignore the event - we probably got it while loading the list,
// and if we have no list it's expected to be unable to find the widget.
cancel()
load()
}

// Either we didn't find the widget (possibly because the server didn't give us invisible widgets),
// or we couldn't update it because we couldn't trust the data, so reload the page
cancel()
load()
} catch (e: JSONException) {
Log.w(TAG, "Could not parse SSE event ('$payload')", e)
}
Expand Down

0 comments on commit b6c3b63

Please sign in to comment.