Commit a5ab0fcd21ce8f881036e23c0db45f31bdd8ec38
flush if scheduler is not running
Norton Wang committed on 3/6/2018, 11:59:37 PMParent: a14ec41fadf0f202a60992c8b084dfcb9a786ad9
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -100,11 +100,15 @@ | ||
100 | 100 | * @returns {Promise} |
101 | 101 | */ |
102 | 102 | createStateRoot () { |
103 | 103 | return new Promise((resolve, reject) => { |
104 | - this.scheduler.on('idle', () => { | |
104 | + if (!this.scheduler._running) { | |
105 | 105 | this.tree.flush().then(resolve) |
106 | - }) | |
106 | + } else { | |
107 | + this.scheduler.on('idle', () => { | |
108 | + this.tree.flush().then(resolve) | |
109 | + }) | |
110 | + } | |
107 | 111 | }) |
108 | 112 | } |
109 | 113 | |
110 | 114 | /** |
Built with git-ssb-web