Browse Source

fix: tighten Media openLive opening lock around close and rejoin

main
xiaosi 2 weeks ago
parent
commit
8237204293
  1. 5
      src/views/MediaView/MediaView.vue

5
src/views/MediaView/MediaView.vue

@ -305,9 +305,10 @@ async function openLive(stream) {
return return
} }
opening = true
try {
await closeActiveLive() await closeActiveLive()
if (disposed) return if (disposed) return
opening = true
const seq = ++openSeq const seq = ++openSeq
try { try {
const result = await joinLiveWithRetry(stream.dockId, {}, { const result = await joinLiveWithRetry(stream.dockId, {}, {
@ -351,11 +352,13 @@ async function openLive(stream) {
} catch (e) { } catch (e) {
if (seq !== openSeq || disposed || e?.code === 'ABORTED') return if (seq !== openSeq || disposed || e?.code === 'ABORTED') return
if (isLeaseInvalidError(e)) { if (isLeaseInvalidError(e)) {
opening = false // unlock before nested openLive via rejoin
await rejoinAfterLeaseInvalid(stream.id, stream.dockId) await rejoinAfterLeaseInvalid(stream.id, stream.dockId)
return return
} }
await closeActiveLive() await closeActiveLive()
ui.toast(e.message || '打开直播失败') ui.toast(e.message || '打开直播失败')
}
} finally { } finally {
opening = false opening = false
} }

Loading…
Cancel
Save