Skip to content

Commit

Permalink
Don't kill SSE on exception (#2200)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-zaitsev authored Dec 17, 2024
1 parent 4848e9f commit d1096a5
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,14 @@ object DeviceService {
call.response.cacheControl(CacheControl.NoCache(null))
call.respondBytesWriter(contentType = ContentType.Text.EventStream) {
while (true) {
val deviceScreen = getDeviceScreen(maestro)
writeStringUtf8("data: $deviceScreen\n\n")
flush()
try {
val deviceScreen = getDeviceScreen(maestro)
writeStringUtf8("data: $deviceScreen\n\n")
flush()
} catch (e: Exception) {
// Ignoring the exception to prevent SSE stream from dying
e.printStackTrace()
}
}
}
}
Expand Down

0 comments on commit d1096a5

Please sign in to comment.