fix gc timeout
This commit is contained in:
		
							parent
							
								
									2ea163a5cf
								
							
						
					
					
						commit
						68c417fe6f
					
				@ -79,7 +79,7 @@ export default function extendDatabase (Y /* :any */) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      function garbageCollect () {
 | 
					      function garbageCollect () {
 | 
				
			||||||
        return os.whenTransactionsFinished().then(function () {
 | 
					        return os.whenTransactionsFinished().then(function () {
 | 
				
			||||||
          if (os.gc1.length > 0 || os.gc2.length > 0) {
 | 
					          if (os.gcTimeout > 0 && (os.gc1.length > 0 || os.gc2.length > 0)) {
 | 
				
			||||||
            if (!os.y.connector.isSynced) {
 | 
					            if (!os.y.connector.isSynced) {
 | 
				
			||||||
              console.warn('gc should be empty when not synced!')
 | 
					              console.warn('gc should be empty when not synced!')
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@ -265,7 +265,7 @@ export default function extendDatabase (Y /* :any */) {
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    * destroy () {
 | 
					    * destroy () {
 | 
				
			||||||
      clearInterval(this.gcInterval)
 | 
					      clearTimeout(this.gcInterval)
 | 
				
			||||||
      this.gcInterval = null
 | 
					      this.gcInterval = null
 | 
				
			||||||
      this.stopRepairCheck()
 | 
					      this.stopRepairCheck()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										8
									
								
								src/y.js
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								src/y.js
									
									
									
									
									
								
							@ -225,13 +225,13 @@ class YConfig {
 | 
				
			|||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      this.connector.disconnect()
 | 
					      this.connector.disconnect()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return this.db.whenTransactionsFinished(function () {
 | 
					    return this.db.whenTransactionsFinished().then(function () {
 | 
				
			||||||
      this.db.destroyTypes()
 | 
					      self.db.destroyTypes()
 | 
				
			||||||
      // make sure to wait for all transactions before destroying the db
 | 
					      // make sure to wait for all transactions before destroying the db
 | 
				
			||||||
      this.db.requestTransaction(function * () {
 | 
					      self.db.requestTransaction(function * () {
 | 
				
			||||||
        yield * self.db.destroy()
 | 
					        yield * self.db.destroy()
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
      return this.db.whenTransactionsFinished()
 | 
					      return self.db.whenTransactionsFinished()
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -55,6 +55,9 @@ export async function compareUsers (t, users) {
 | 
				
			|||||||
      t.compare(data[i].ss, data[i + 1].ss, 'ss')
 | 
					      t.compare(data[i].ss, data[i + 1].ss, 'ss')
 | 
				
			||||||
    }, `Compare user${i} with user${i + 1}`)
 | 
					    }, `Compare user${i} with user${i + 1}`)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  await Promise.all(users.map(async (u) => {
 | 
				
			||||||
 | 
					    await u.close()
 | 
				
			||||||
 | 
					  }))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export async function initArrays (t, opts) {
 | 
					export async function initArrays (t, opts) {
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,4 @@
 | 
				
			|||||||
/* global Y */
 | 
					/* global Y */
 | 
				
			||||||
import { wait } from './helper.js'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
var rooms = {}
 | 
					var rooms = {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user