delay writing disk cache until block handler completes

This commit is contained in:
Mononaut
2023-05-01 14:30:30 -06:00
parent e807b3ca74
commit e5f97ace8b
3 changed files with 39 additions and 0 deletions

View File

@@ -533,6 +533,8 @@ class Blocks {
// warn if this run stalls the main loop for more than 2 minutes
const timer = this.startTimer();
diskCache.lock();
let fastForwarded = false;
const blockHeightTip = await bitcoinApi.$getBlockHeightTip();
this.updateTimerProgress(timer, 'got block height tip');
@@ -697,6 +699,8 @@ class Blocks {
this.updateTimerProgress(timer, `async callbacks completed for ${this.currentBlockHeight}`);
}
diskCache.unlock();
this.clearTimer(timer);
}