Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BatchImport: Ignore sniffed jobs below minimum size #784

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/BatchImport.vala
Original file line number Diff line number Diff line change
Expand Up @@ -1452,6 +1452,7 @@ private class FileToPrepare {
}

private class WorkSniffer : BackgroundImportJob {
private const uint MIN_SIZE = 64;
public Gee.List<FileToPrepare> files_to_prepare = new Gee.ArrayList<FileToPrepare> ();
public uint64 total_bytes = 0;

Expand Down Expand Up @@ -1551,7 +1552,7 @@ private class WorkSniffer : BackgroundImportJob {
}

private void sniff_job (BatchImportJob job) throws Error {
uint64 size;
uint64 size = 0;
File file_or_dir;
bool determined_size = job.determine_file_size (out size, out file_or_dir);
if (determined_size)
Expand All @@ -1578,8 +1579,15 @@ private class WorkSniffer : BackgroundImportJob {
}
} else {
// if did not get the file size, do so now
if (!determined_size)
total_bytes += query_total_file_size (file_or_dir, get_cancellable ());
if (!determined_size) {
size = query_total_file_size (file_or_dir, get_cancellable ());
}

if (size < MIN_SIZE) {
return;
}

total_bytes += size;

// job is a direct file, so no need to search, prepare it directly
if ((file_or_dir != null) && skipset != null && skipset.contains (file_or_dir))
Expand Down