mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-09 01:12:29 +02:00
Implement Feature: Make checkinterval for monitor configurable
* Implement feature request 'Make checkinterval for monitor configurable' (Issue #31)
This commit is contained in:
parent
6daa637ff2
commit
1a178d38f8
|
@ -219,8 +219,9 @@ This file does not get created by default, and should only be created if you wan
|
|||
|
||||
Available options:
|
||||
* `sync_dir`: directory where the files will be synced
|
||||
* `skip_file`: any files or directories that match this pattern will be skipped during sync.
|
||||
* `skip_file`: any files or directories that match this pattern will be skipped during sync
|
||||
* `skip_symlinks`: any files or directories that are symlinked will be skipped during sync
|
||||
* `monitor_interval`: time interval in seconds by which the monitor process will process local and remote changes
|
||||
|
||||
### sync_dir
|
||||
Example: `sync_dir="~/MyDirToSync"`
|
||||
|
@ -242,6 +243,11 @@ Example: `skip_symlinks = "true"`
|
|||
|
||||
Setting this to `"true"` will skip all symlinks while syncing.
|
||||
|
||||
### monitor_interval
|
||||
Example: `monitor_interval = "300"`
|
||||
|
||||
By default without configuration, the monitor_interval is set to 45 seconds. Set this value to a valid number. Setting this value to 300 will run the sync process every 5 minutes.
|
||||
|
||||
### Selective sync
|
||||
Selective sync allows you to sync only specific files and directories.
|
||||
To enable selective sync create a file named `sync_list` in `~/.config/onedrive`.
|
||||
|
|
|
@ -33,6 +33,10 @@ final class Config
|
|||
// By default symlinks are not skipped (using string type
|
||||
// instead of boolean because hashmap only stores string types)
|
||||
setValue("skip_symlinks", "false");
|
||||
// Configure the monitor mode loop - the number of seconds by which
|
||||
// each sync operation is undertaken when idle under monitor mode
|
||||
setValue("monitor_interval", "45");
|
||||
|
||||
if (!load(userConfigFilePath)) {
|
||||
log.vlog("No config file found, using defaults");
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import core.stdc.stdlib: EXIT_SUCCESS, EXIT_FAILURE;
|
||||
import core.memory, core.time, core.thread;
|
||||
import std.getopt, std.file, std.path, std.process, std.stdio;
|
||||
import std.getopt, std.file, std.path, std.process, std.stdio, std.conv;
|
||||
import config, itemdb, monitor, onedrive, selective, sync, util;
|
||||
static import log;
|
||||
|
||||
|
@ -296,7 +296,8 @@ int main(string[] args)
|
|||
};
|
||||
if (!downloadOnly) m.init(cfg, verbose);
|
||||
// monitor loop
|
||||
immutable auto checkInterval = dur!"seconds"(45);
|
||||
log.vlog("Monitor Loop: ", to!long(cfg.getValue("monitor_interval")));
|
||||
immutable auto checkInterval = dur!"seconds"(to!long(cfg.getValue("monitor_interval")));
|
||||
auto lastCheckTime = MonoTime.currTime();
|
||||
while (true) {
|
||||
if (!downloadOnly) m.update(online);
|
||||
|
|
Loading…
Reference in a new issue