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

Config Rsync threshold #28

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions realsync
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ sub mainloop {
$FILE_IDENTITY = $CONFIG{identity};
}

# Set the number of changes that will trigger an rsync from the config file
$MIN_CHANGES_FOR_RSYNC = cfg("rsync_threshold");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should have a default value, or realsync will break for people who don't have this option in their config yet?

print "mainloop MIN_CHANGES_FOR_RSYNC: $MIN_CHANGES_FOR_RSYNC\n";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug printing? remove?


# We MUST avoid chdir: in Cygwin we have problems with non-ASCII names.
-d cfg("local") or die "Bad local directory " . cfg("local") . ": $!\n";

Expand Down Expand Up @@ -538,6 +542,12 @@ sub do_install {
. "system, so developers may just override options in their own local files."
};

push @config, {
"name" => "#rsync_threshold",
"value" => "10",
"comment" => "How many files triggers an rsync, vs a file by file transfer.",
};

push @config, {
"name" => "#rsync_options",
"value" => join(" ", @RSYNC_OPTIONS),
Expand Down Expand Up @@ -629,6 +639,9 @@ sub cfg {
if ($name eq "rsync_options") {
$value ||= join(" ", @RSYNC_OPTIONS);
}
if ($name eq "rsync_threshold") {
$value ||= $MIN_CHANGES_FOR_RSYNC;
}
if (!$nodie) {
if (!defined $value) {
die("Cannot read \"$name\" configuration option at $FILE_CONFIG!\n");
Expand Down