send sync step 1 after sync step 2 is processed (for slaves)
This commit is contained in:
		
							parent
							
								
									be3b8b65ce
								
							
						
					
					
						commit
						edb5e4f719
					
				@ -92,6 +92,7 @@ export function computeMessageSyncStep1 (decoder, encoder, conn, senderConn, sen
 | 
				
			|||||||
    conn.y.destroy()
 | 
					    conn.y.destroy()
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return conn.y.db.whenTransactionsFinished().then(() => {
 | 
				
			||||||
    // send sync step 2
 | 
					    // send sync step 2
 | 
				
			||||||
    conn.y.db.requestTransaction(function * () {
 | 
					    conn.y.db.requestTransaction(function * () {
 | 
				
			||||||
      encoder.writeVarString('sync step 2')
 | 
					      encoder.writeVarString('sync step 2')
 | 
				
			||||||
@ -109,10 +110,12 @@ export function computeMessageSyncStep1 (decoder, encoder, conn, senderConn, sen
 | 
				
			|||||||
      conn.send(senderConn.uid, encoder.createBuffer())
 | 
					      conn.send(senderConn.uid, encoder.createBuffer())
 | 
				
			||||||
      senderConn.receivedSyncStep2 = true
 | 
					      senderConn.receivedSyncStep2 = true
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					    return conn.y.db.whenTransactionsFinished().then(() => {
 | 
				
			||||||
      if (conn.role === 'slave') {
 | 
					      if (conn.role === 'slave') {
 | 
				
			||||||
        sendSyncStep1(conn, sender)
 | 
					        sendSyncStep1(conn, sender)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
  return conn.y.db.whenTransactionsFinished()
 | 
					    })
 | 
				
			||||||
 | 
					  })
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function logSS (decoder, strBuilder) {
 | 
					export function logSS (decoder, strBuilder) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user