all: Transition to using fs watcher by default (fixes #4552)

This commit is contained in:
Simon Frei
2018-03-25 22:05:47 +02:00
committed by Audrius Butkevicius
parent d6bb8e6e06
commit a557d62c4a
13 changed files with 173 additions and 68 deletions

View File

@@ -53,6 +53,7 @@ angular.module('syncthing.core')
$scope.globalChangeEvents = {};
$scope.metricRates = false;
$scope.folderPathErrors = {};
$scope.currentFolder = {};
resetRemoteNeed();
try {
@@ -62,8 +63,9 @@ angular.module('syncthing.core')
$scope.folderDefaults = {
selectedDevices: {},
type: "readwrite",
rescanIntervalS: 60,
rescanIntervalS: 3600,
fsWatcherDelayS: 10,
fsWatcherEnabled: true,
minDiskFree: {value: 1, unit: "%"},
maxConflicts: 10,
fsync: true,
@@ -1504,6 +1506,14 @@ angular.module('syncthing.core')
$scope.currentFolder.path = pathJoin($scope.config.options.defaultFolderPath, newvalue);
});
$scope.$watch('currentFolder.fsWatcherEnabled', function (newvalue) {
if (newvalue) {
$scope.currentFolder.rescanIntervalS = 3600;
} else {
$scope.currentFolder.rescanIntervalS = 60;
}
});
$scope.loadFormIntoScope = function (form) {
console.log('loadFormIntoScope',form.$name);
switch (form.$name) {
@@ -2126,6 +2136,28 @@ angular.module('syncthing.core')
return false;
};
$scope.activateAllFsWatchers = function() {
var folders = $scope.folderList();
$.each(folders, function(i) {
if (folders[i].fsWatcherEnabled) {
return;
}
folders[i].fsWatcherEnabled = true;
if (folders[i].rescanIntervalS === 0) {
return;
}
// Delay full scans, but scan at least once per day
folders[i].rescanIntervalS *= 60;
if (folders[i].rescanIntervalS > 86400) {
folders[i].rescanIntervalS = 86400;
}
});
$scope.config.folders = folders;
$scope.saveConfig();
};
$scope.bumpFile = function (folder, file) {
var url = urlbase + "/db/prio?folder=" + encodeURIComponent(folder) + "&file=" + encodeURIComponent(file);
// In order to get the right view of data in the response.