Tiny optimisation
This commit is contained in:
parent
2a4d9a85d5
commit
96ae960070
3 changed files with 6 additions and 1 deletions
|
|
@ -190,6 +190,7 @@ impl ChunkTracker {
|
|||
file_priorities
|
||||
.iter()
|
||||
.filter_map(|p| opened_files.get(*p))
|
||||
.filter(|f| !f.approx_is_finished())
|
||||
.flat_map(|f| f.iter_piece_priorities())
|
||||
.filter(|id| self.queue_pieces[*id])
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,6 +109,10 @@ impl OpenedFile {
|
|||
size
|
||||
}
|
||||
|
||||
pub fn approx_is_finished(&self) -> bool {
|
||||
self.have.load(Ordering::Relaxed) == self.len
|
||||
}
|
||||
|
||||
pub fn iter_piece_priorities(&self) -> impl Iterator<Item = usize> {
|
||||
iter_piece_priorities(self.piece_range_usize())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ struct Opts {
|
|||
log_file: Option<String>,
|
||||
|
||||
/// The value for RUST_LOG in the log file
|
||||
#[arg(long = "log-file-rust-log", default_value = "librqbit=trace,info")]
|
||||
#[arg(long = "log-file-rust-log", default_value = "librqbit=debug,info")]
|
||||
log_file_rust_log: String,
|
||||
|
||||
/// The interval to poll trackers, e.g. 30s.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue