Merge branch 'users-statuses-pinia' into weight-removal
This commit is contained in:
commit
13d799c14c
2 changed files with 18 additions and 5 deletions
|
|
@ -108,7 +108,19 @@ export const useStreamingStore = defineStore('streaming', {
|
|||
}
|
||||
},
|
||||
initSocket(initial) {
|
||||
if (this.socket) throw new Error('Socket already exists!')
|
||||
if (this.socket) {
|
||||
console.error(
|
||||
"Socket already exists! This shouldn't happen! Force-closing the socket just in case",
|
||||
)
|
||||
try {
|
||||
this.socket.close()
|
||||
} catch (e) {
|
||||
console.error(
|
||||
"Error closing existing socket that shouldn't be there. Welp. Moving on.",
|
||||
e,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
this.state = initial
|
||||
? WSConnectionStatus.STARTING_INITIAL
|
||||
|
|
@ -130,7 +142,9 @@ export const useStreamingStore = defineStore('streaming', {
|
|||
this.socket.addEventListener('error', this.onError)
|
||||
},
|
||||
stopSocket() {
|
||||
this.socket.close()
|
||||
if (this.socket == null)
|
||||
console.error("Socket is already stopped! This shouldn't happen!")
|
||||
this.socket?.close()
|
||||
this.socket = null
|
||||
this.state = WSConnectionStatus.CLOSED
|
||||
this.retrying = false
|
||||
|
|
@ -235,7 +249,7 @@ export const useStreamingStore = defineStore('streaming', {
|
|||
)
|
||||
|
||||
setTimeout(() => {
|
||||
if (this.retrying) return // retry aborted (i.e. due to logout)
|
||||
if (!this.retrying) return // retry aborted (i.e. due to logout)
|
||||
|
||||
this.initSocket()
|
||||
}, retryTimeout(this.retryMultiplier))
|
||||
|
|
|
|||
|
|
@ -278,9 +278,8 @@ export const useUsersStore = defineStore('users', {
|
|||
|
||||
map.set(identifier, promise)
|
||||
|
||||
const result = await promise
|
||||
|
||||
try {
|
||||
const result = await promise
|
||||
if (result) {
|
||||
const { id, screen_name } = result
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue