Extend GitHub version check (#1863)

* Extend GitHub version check to be done once per day when running in --monitor
* Change notification to also notify GUI if notifications are being utilized
This commit is contained in:
abraunegg 2022-03-07 14:02:50 +11:00 committed by GitHub
parent bb889f130e
commit ff78e84efd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 4 deletions

View file

@ -36,7 +36,7 @@ void init(string logDir)
// we got an error ..
writeln("\nUnable to access ", logFilePath);
writeln("Please manually create '",logFilePath, "' and set appropriate permissions to allow write access");
writeln("The requested client activity log will instead be located in your users home directory\n");
writeln("The requested client activity log will instead be located in your users home directory");
}
}
}

View file

@ -689,8 +689,10 @@ int main(string[] args)
return EXIT_FAILURE;
}
}
} else {
// Check application version and Initialize OneDrive API, check for authorization
}
// Check application version and Initialize OneDrive API, check for authorization
if (online) {
// Check Application Version
log.vlog("Checking Application Version ...");
checkApplicationVersion();
@ -1142,9 +1144,12 @@ int main(string[] args)
bool performMonitor = true;
ulong monitorLoopFullCount = 0;
immutable auto checkInterval = dur!"seconds"(cfg.getValueLong("monitor_interval"));
immutable auto githubCheckInterval = dur!"seconds"(86400);
immutable long logInterval = cfg.getValueLong("monitor_log_frequency");
immutable long fullScanFrequency = cfg.getValueLong("monitor_fullscan_frequency");
MonoTime lastCheckTime = MonoTime.currTime();
MonoTime lastGitHubCheckTime = MonoTime.currTime();
long logMonitorCounter = 0;
long fullScanCounter = 0;
// set fullScanRequired to true so that at application startup we perform a full walk
@ -1205,6 +1210,14 @@ int main(string[] args)
// Skipping uploading this new file as parent path is not in the database: target/2eVPInOMTFNXzRXeNMEoJch5OR9XpGby
// 'target' should be in the DB, it should also exist online, but because of --resync, it does not exist in the database thus parent check fails
if (notificationReceived || (currTime - lastCheckTime > checkInterval) || (monitorLoopFullCount == 0)) {
// Check Application Version against GitHub once per day
if (currTime - lastGitHubCheckTime > githubCheckInterval) {
// --monitor GitHub Application Version Check time expired
checkApplicationVersion();
// update when we have performed this check
lastGitHubCheckTime = MonoTime.currTime();
}
// monitor sync loop
logOutputMessage = "################################################## NEW LOOP ##################################################";
if (displaySyncOptions) {

View file

@ -388,7 +388,11 @@ void checkApplicationVersion() {
// application version is older than available on GitHub
if (applicationVersion < latestVersion) {
// application version is obsolete and unsupported
log.log("\nWARNING: Your onedrive client is obsolete and unsupported. Please upgrade your client version.\n");
writeln();
log.logAndNotify("WARNING: Your onedrive client version is obsolete and unsupported. Please upgrade your client version.");
log.vlog("Application version: ", applicationVersion);
log.vlog("Version available: ", latestVersion);
writeln();
}
}
}