Create all shared buffer readers before spawning threads (#27512)
* Create all shared buffer readers before spawning threads * Allow 'needless' collect - clippy is wrong * move clippy allow, spacing
This commit is contained in:
parent
66717ff87d
commit
af971e63ab
|
@ -1203,15 +1203,24 @@ fn streaming_unarchive_snapshot(
|
|||
let ledger_dir = Arc::new(ledger_dir);
|
||||
let shared_buffer = untar_snapshot_create_shared_buffer(&snapshot_archive_path, archive_format);
|
||||
|
||||
(0..num_threads)
|
||||
.map(|thread_index| {
|
||||
// All shared buffer readers need to be created before the threads are spawned
|
||||
#[allow(clippy::needless_collect)]
|
||||
let archives: Vec<_> = (0..num_threads)
|
||||
.map(|_| {
|
||||
let reader = SharedBufferReader::new(&shared_buffer);
|
||||
Archive::new(reader)
|
||||
})
|
||||
.collect();
|
||||
|
||||
archives
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.map(|(thread_index, archive)| {
|
||||
let parallel_selector = Some(ParallelSelector {
|
||||
index: thread_index,
|
||||
divisions: num_threads,
|
||||
});
|
||||
|
||||
let reader = SharedBufferReader::new(&shared_buffer);
|
||||
let archive = Archive::new(reader);
|
||||
spawn_unpack_snapshot_thread(
|
||||
file_sender.clone(),
|
||||
account_paths.clone(),
|
||||
|
|
Loading…
Reference in New Issue