Match Windows I/O priority to other platforms: loading external block files and reading blocks raw

This commit is contained in:
Luke Dashjr 2025-03-05 00:02:50 +00:00
parent 8c989494c2
commit 67d111426a
2 changed files with 4 additions and 1 deletions

View File

@ -1049,7 +1049,7 @@ bool BlockManager::ReadBlockFromDisk(CBlock& block, const FlatFilePos& pos, cons
return false;
}
filein.SetIdlePriority();
if (lowprio) filein.SetIdlePriority();
// Read block
try {
@ -1109,6 +1109,8 @@ bool BlockManager::ReadRawBlockFromDisk(std::vector<uint8_t>& block, const FlatF
return false;
}
if (lowprio) filein.SetIdlePriority();
try {
MessageStartChars blk_start;
unsigned int blk_size;

View File

@ -5038,6 +5038,7 @@ void ChainstateManager::LoadExternalBlockFile(
int nLoaded = 0;
try {
IOPRIO_IDLER(/*lowprio=*/true);
file_in.SetIdlePriority();
BufferedFile blkdat{file_in, 2 * MAX_BLOCK_SERIALIZED_SIZE, MAX_BLOCK_SERIALIZED_SIZE + 8};
// nRewind indicates where to resume scanning in case something goes wrong,