handle some edge cases for socket lifecycle
This commit is contained in:
parent
43ddbfd652
commit
64cc748a9c
2 changed files with 8 additions and 0 deletions
|
|
@ -72,6 +72,9 @@ const GeneralTab = {
|
|||
useLocalConfigStore().set({ path, value })
|
||||
},
|
||||
toggleStreaming(value) {
|
||||
// Streaming is not available for the unauthenticated
|
||||
if (!useOAuthStore().token) return
|
||||
|
||||
if (value) {
|
||||
useStreamingStore().initSocket()
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -130,6 +130,9 @@ export const useStreamingStore = defineStore('streaming', {
|
|||
stopSocket() {
|
||||
this.socket.close()
|
||||
this.state = WSConnectionStatus.CLOSED
|
||||
this.retrying = false
|
||||
this.retryMultiplier = 1
|
||||
this.error = null
|
||||
},
|
||||
|
||||
getSubArgs(stream) {
|
||||
|
|
@ -229,6 +232,8 @@ export const useStreamingStore = defineStore('streaming', {
|
|||
)
|
||||
|
||||
setTimeout(() => {
|
||||
if (this.retrying) return // retry aborted (i.e. due to logout)
|
||||
|
||||
this.initSocket()
|
||||
}, retryTimeout(this.retryMultiplier))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue