Lounge session crash bug fix

This commit is contained in:
Brahim Hadriche committed 2024-05-10 12:24:53 -04:00
1 parent b254a1fe93
commit 015e84b41e
2 files changed
+11 -7

No files matched your search

+1
View File
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- a bug where trending and search wouldn't work in certain countries (web app) - a bug where trending and search wouldn't work in certain countries (web app)
- A crash when lounge session is lost and fails to recover
## [0.23.4] - 2024-05-04 ## [0.23.4] - 2024-05-04
@@ -49,14 +49,14 @@ function LoungeServiceLoop() as void
screenId = api.GetScreenId() screenId = api.GetScreenId()
if StringUtils.IsNullOrEmpty(screenId) if StringUtils.IsNullOrEmpty(screenId)
m.top.isRunning = false Shutdown("No screen ID found")
return return
end if end if
m.top.screenId = screenId m.top.screenId = screenId
loungeToken = api.GetToken() loungeToken = api.GetToken()
if StringUtils.IsNullOrEmpty(loungeToken) if StringUtils.IsNullOrEmpty(loungeToken)
m.top.isRunning = false Shutdown("No lounge token found")
return return
end if end if
m.top.loungeToken = loungeToken m.top.loungeToken = loungeToken
@@ -64,8 +64,7 @@ function LoungeServiceLoop() as void
m.top.observeField("outgoingMessages", messagePort) m.top.observeField("outgoingMessages", messagePort)
if not api.GetSessionData() if not api.GetSessionData()
m.top.unobserveField("outgoingMessages", messagePort) Shutdown("Failed to get session data")
m.top.isRunning = false
return return
end if end if
@@ -142,8 +141,7 @@ function LoungeServiceLoop() as void
' We lost the session for some reason, so we need to rejoin the lounge ' We lost the session for some reason, so we need to rejoin the lounge
LogWarn("Lost session, rejoining") LogWarn("Lost session, rejoining")
if not api.GetSessionData() if not api.GetSessionData()
m.top.unobserveField("outgoingMessages", messagePort) Shutdown("Failed to rejoin session data")
m.top.isRunning = false
return return
end if end if
@@ -154,6 +152,11 @@ function LoungeServiceLoop() as void
end if end if
end while end while
m.top.unobserveField("outgoingMessages", messagePort) Shutdown("Service stopped")
end function
function Shutdown(reason as string)
LogInfo("Shutting down:", reason)
m.top.unobserveField("outgoingMessages")
m.top.isRunning = false m.top.isRunning = false
end function end function