mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-10 09:46:40 +02:00
* Tighten up the logging output to better clarify what is occurring when sync_list is being used
This commit is contained in:
parent
b1fcb814c3
commit
4cb0ebbfde
|
@ -562,6 +562,11 @@ int main(string[] args)
|
|||
}
|
||||
}
|
||||
|
||||
// if sync list is configured, set to true now that the sync engine is initialised
|
||||
if (syncListConfigured) {
|
||||
sync.setSyncListConfigured();
|
||||
}
|
||||
|
||||
// Do we need to configure specific --upload-only options?
|
||||
if (cfg.getValueBool("upload_only")) {
|
||||
// --upload-only was passed in or configured
|
||||
|
|
65
src/sync.d
65
src/sync.d
|
@ -236,6 +236,8 @@ final class SyncEngine
|
|||
private bool syncBusinessFolders = false;
|
||||
// single directory scope flag
|
||||
private bool singleDirectoryScope = false;
|
||||
// is sync_list configured
|
||||
private bool syncListConfigured = false;
|
||||
// sync_list new folder added, trigger delta scan override
|
||||
private bool syncListFullScanTrigger = false;
|
||||
|
||||
|
@ -456,6 +458,13 @@ final class SyncEngine
|
|||
log.vdebug("Setting syncListFullScanTrigger = false");
|
||||
}
|
||||
|
||||
// set syncListConfigured to true
|
||||
void setSyncListConfigured()
|
||||
{
|
||||
syncListConfigured = true;
|
||||
log.vdebug("Setting syncListConfigured = true");
|
||||
}
|
||||
|
||||
// download all new changes from OneDrive
|
||||
void applyDifferences(bool performFullItemScan)
|
||||
{
|
||||
|
@ -792,10 +801,21 @@ final class SyncEngine
|
|||
// Get the current delta link
|
||||
string deltaLink = "";
|
||||
string deltaLinkAvailable = itemdb.getDeltaLink(driveId, id);
|
||||
log.vdebug("syncListConfigured = ", syncListConfigured);
|
||||
log.vdebug("syncListFullScanTrigger = ", syncListFullScanTrigger);
|
||||
log.vdebug("performFullItemScan = ", performFullItemScan);
|
||||
// if sync_list is not configured, syncListConfigured should be false
|
||||
// depending on the scan type (--monitor or --synchronize) performFullItemScan is set depending on the number of sync passes performed (--monitor) or ALWAYS if just --synchronize is used
|
||||
if (!performFullItemScan){
|
||||
// performFullItemScan == false
|
||||
// use delta link
|
||||
deltaLink = deltaLinkAvailable;
|
||||
log.vdebug("performFullItemScan is false, using the deltaLink as per database entry");
|
||||
if (deltaLinkAvailable == ""){
|
||||
log.vdebug("deltaLink was requested to be used, but contains no data - resulting API query will be treated as a full scan of OneDrive");
|
||||
} else {
|
||||
log.vdebug("deltaLink contains valid data - resulting API query will be treated as a delta scan of OneDrive");
|
||||
}
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
|
@ -878,33 +898,38 @@ final class SyncEngine
|
|||
auto nrChanges = count(changes["value"].array);
|
||||
auto changeCount = 0;
|
||||
|
||||
if (!performFullItemScan){
|
||||
// Display the number of changes we are processing
|
||||
// OneDrive ships 'changes' in ~200 bundles. These messages then get displayed for each bundle
|
||||
if (nrChanges >= cfg.getValueLong("min_notify_changes")) {
|
||||
// verbose log, no 'notify' .. it is over the top
|
||||
// Display the number of changes or OneDrive objects we are processing
|
||||
// OneDrive ships 'changes' in ~200 bundles. We display that we are processing X number of objects
|
||||
// Do not display anything unless we are doing a verbose debug as due to #658 we are essentially doing a --resync each time when using sync_list
|
||||
|
||||
// is nrChanges >= min_notify_changes (default of min_notify_changes = 5)
|
||||
if (nrChanges >= cfg.getValueLong("min_notify_changes")) {
|
||||
// nrChanges is >= than min_notify_changes
|
||||
// verbose log, no 'notify' .. it is over the top
|
||||
if (!syncListConfigured) {
|
||||
// sync_list is not being used - lets use the right messaging here
|
||||
log.vlog("Processing ", nrChanges, " changes");
|
||||
} else {
|
||||
// There are valid changes
|
||||
log.vdebug("Number of changes from OneDrive to process: ", nrChanges);
|
||||
// sync_list is being used - why are we going through the entire OneDrive contents?
|
||||
log.vlog("Processing ", nrChanges, " OneDrive items to ensure consistent state due to sync_list being used");
|
||||
}
|
||||
} else {
|
||||
// Do not display anything unless we are doing a verbose debug as due to #658 we are essentially doing a --resync each time when using sync_list
|
||||
// Display the number of items we are processing
|
||||
if (nrChanges >= cfg.getValueLong("min_notify_changes")) {
|
||||
// verbose log, no 'notify' .. it is over the top
|
||||
log.vlog("Processing ", nrChanges, " OneDrive items to ensure consistent state due to sync_list being used");
|
||||
} else {
|
||||
// There are valid changes
|
||||
log.vdebug("Number of items from OneDrive to process: ", nrChanges);
|
||||
}
|
||||
// There are valid changes but less than the min_notify_changes configured threshold
|
||||
// We will only output the number of changes being processed to debug log if this is set to assist with debugging
|
||||
// As this is debug logging, messaging can be the same, regardless of sync_list being used or not
|
||||
log.vdebug("Number of changes from OneDrive to process: ", nrChanges);
|
||||
|
||||
// unset now the full scan trigger if set
|
||||
if (syncListFullScanTrigger) {
|
||||
unsetSyncListFullScanTrigger();
|
||||
// is performFullItemScan set due to a full scan required?
|
||||
if (performFullItemScan){
|
||||
// full scan was triggered due to using sync_list
|
||||
log.vdebug("Number of items from OneDrive to process: ", nrChanges);
|
||||
// unset now the full scan trigger if set
|
||||
if (syncListFullScanTrigger) {
|
||||
unsetSyncListFullScanTrigger();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (item; changes["value"].array) {
|
||||
bool isRoot = false;
|
||||
string thisItemPath;
|
||||
|
|
Loading…
Reference in a new issue