Skip to content

Commit

Permalink
add more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
chm-diederichs committed Apr 4, 2024
1 parent 10c2c79 commit 49a455b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,20 +359,27 @@ module.exports = class Autobase extends ReadyResource {
}

async _close () {
if (this.debug) console.log('awaiting promise...')
await Promise.resolve() // defer one tick

const closing = this._advancing.catch(safetyCatch)

if (this.debug) console.log('awaiting ack timer closing...')
if (this._ackTimer) {
this._ackTimer.stop()
await this._ackTimer.flush()
}

if (this.debug) console.log('awaiting wakeup closing...')
await this._wakeup.close()

if (this.debug) console.log('awaiting handlers closing...')
if (this._hasClose) await this._handlers.close(this.view)
if (this.debug) console.log('awaiting primary closing...')
if (this._primaryBootstrap) await this._primaryBootstrap.close()
if (this.debug) console.log('awaiting store closing...')
await this.store.close()
if (this.debug) console.log('awaiting closing...')
await closing
}

Expand Down
2 changes: 2 additions & 0 deletions test/flake.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ for (let i = 0; i < 1000; i++) {
apply: applyOldState
})

b2.debug = true
await b2.ready()
console.log('READY')
await t.execution(b2.ready())

async function applyOldState (batch, view, base) {
Expand Down

0 comments on commit 49a455b

Please sign in to comment.