all: Transition to using fs watcher by default (fixes #4552)
This commit is contained in:
committed by
Audrius Butkevicius
parent
d6bb8e6e06
commit
a557d62c4a
@@ -41,3 +41,31 @@
|
||||
</div>
|
||||
</div>
|
||||
</notification>
|
||||
|
||||
<notification id="fsWatcherNotification">
|
||||
<div class="panel panel-success">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title"><span class="fa fa-flash"></span> <span translate>Watching for Changes</span></h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p translate>Continuously watching for changes is now available within Syncthing. This will detect changes on disk and issue a scan on only the modified paths. The benefits are that changes are propagated quicker and that less full scans are required.</p>
|
||||
<p><a href="https://docs.syncthing.net/users/syncing.html#scanning"><span class="fa fa-fw fa-book"></span> <span translate>Learn more</span></a></p>
|
||||
<p>
|
||||
<span translate>Do you want to enable watching for changes for all your folders?</span><br/>
|
||||
<span translate>Additionally the full rescan interval will be increased (times 60, i.e. new default of 1h). You can also configure it manually for every folder later after choosing No.</span>
|
||||
</p>
|
||||
<p translate translate-value-syncthing-inotify="syncthing-inotify">Warning: If you are using an external watcher like {%syncthingInotify%}, you should make sure it is deactivated.</p>
|
||||
</div>
|
||||
<div class="panel-footer clearfix">
|
||||
<div class="pull-right">
|
||||
<button type="button" class="btn btn-primary btn-sm" ng-click="activateAllFsWatchers(); dismiss()">
|
||||
<span class="fa fa-check"></span> <span translate>Yes</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-sm" ng-click="dismiss()">
|
||||
<span class="fa fa-times"></span> <span translate>No</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
</notification>
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user