mirror of https://github.com/langgenius/dify.git
fix duplicated status
This commit is contained in:
parent
bd597497e7
commit
0c18d4e058
|
|
@ -956,7 +956,7 @@ export class CollaborationManager {
|
|||
}
|
||||
})
|
||||
|
||||
socket.on('status', (data: any) => {
|
||||
socket.on('status', (data: { isLeader: boolean }) => {
|
||||
try {
|
||||
if (!data || typeof data.isLeader !== 'boolean') {
|
||||
console.warn('Invalid status data:', data)
|
||||
|
|
@ -966,6 +966,9 @@ export class CollaborationManager {
|
|||
const wasLeader = this.isLeader
|
||||
this.isLeader = data.isLeader
|
||||
|
||||
if (wasLeader !== this.isLeader)
|
||||
console.log(`Collaboration: I am now the ${this.isLeader ? 'Leader' : 'Follower'}.`)
|
||||
|
||||
if (this.isLeader)
|
||||
this.pendingInitialSync = false
|
||||
else
|
||||
|
|
@ -979,30 +982,6 @@ export class CollaborationManager {
|
|||
}
|
||||
})
|
||||
|
||||
socket.on('status', (data: { isLeader: boolean }) => {
|
||||
if (this.isLeader !== data.isLeader) {
|
||||
this.isLeader = data.isLeader
|
||||
console.log(`Collaboration: I am now the ${this.isLeader ? 'Leader' : 'Follower'}.`)
|
||||
this.eventEmitter.emit('leaderChange', this.isLeader)
|
||||
}
|
||||
if (this.isLeader)
|
||||
this.pendingInitialSync = false
|
||||
else
|
||||
this.requestInitialSyncIfNeeded()
|
||||
})
|
||||
|
||||
socket.on('status', (data: { isLeader: boolean }) => {
|
||||
if (this.isLeader !== data.isLeader) {
|
||||
this.isLeader = data.isLeader
|
||||
console.log(`Collaboration: I am now the ${this.isLeader ? 'Leader' : 'Follower'}.`)
|
||||
this.eventEmitter.emit('leaderChange', this.isLeader)
|
||||
}
|
||||
if (this.isLeader)
|
||||
this.pendingInitialSync = false
|
||||
else
|
||||
this.requestInitialSyncIfNeeded()
|
||||
})
|
||||
|
||||
socket.on('connect', () => {
|
||||
console.log('WebSocket connected successfully')
|
||||
this.eventEmitter.emit('stateChange', { isConnected: true })
|
||||
|
|
|
|||
Loading…
Reference in New Issue