mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-20 06:35:14 +02:00
Resolve that upload session are not canceled with resync option
* Resolve that upload session are not canceled with resync option
This commit is contained in:
parent
83726ac4de
commit
d2a78be396
17
src/main.d
17
src/main.d
|
@ -629,12 +629,17 @@ int main(string[] cliArgs) {
|
|||
string localPath = ".";
|
||||
string remotePath = "/";
|
||||
|
||||
// Check if there are interrupted upload session(s)
|
||||
if (syncEngineInstance.checkForInterruptedSessionUploads) {
|
||||
// Need to re-process the session upload files to resume the failed session uploads
|
||||
addLogEntry("There are interrupted session uploads that need to be resumed ...");
|
||||
// Process the session upload files
|
||||
syncEngineInstance.processForInterruptedSessionUploads();
|
||||
if (!appConfig.getValueBool("resync")) {
|
||||
// Check if there are interrupted upload session(s)
|
||||
if (syncEngineInstance.checkForInterruptedSessionUploads) {
|
||||
// Need to re-process the session upload files to resume the failed session uploads
|
||||
addLogEntry("There are interrupted session uploads that need to be resumed ...");
|
||||
// Process the session upload files
|
||||
syncEngineInstance.processForInterruptedSessionUploads();
|
||||
}
|
||||
} else {
|
||||
// Clean up any upload session files due to --resync being used
|
||||
syncEngineInstance.clearInterruptedSessionUploads();
|
||||
}
|
||||
|
||||
// Are we doing a single directory operation (--single-directory) ?
|
||||
|
|
16
src/sync.d
16
src/sync.d
|
@ -7588,6 +7588,22 @@ class SyncEngine {
|
|||
return interruptedUploads;
|
||||
}
|
||||
|
||||
// Clear any session_upload.* files
|
||||
void clearInterruptedSessionUploads() {
|
||||
// Scan the filesystem for the files we are interested in, build up interruptedUploadsSessionFiles array
|
||||
foreach (sessionFile; dirEntries(appConfig.configDirName, "session_upload.*", SpanMode.shallow)) {
|
||||
// calculate the full path
|
||||
string tempPath = buildNormalizedPath(buildPath(appConfig.configDirName, sessionFile));
|
||||
JSONValue sessionFileData = readText(tempPath).parseJSON();
|
||||
addLogEntry("Removing interrupted session upload file due to --resync for: " ~ sessionFileData["localPath"].str, ["info"]);
|
||||
|
||||
// Process removal
|
||||
if (!dryRun) {
|
||||
safeRemove(tempPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Process interrupted 'session_upload' files
|
||||
void processForInterruptedSessionUploads() {
|
||||
// For each upload_session file that has been found, process the data to ensure it is still valid
|
||||
|
|
Loading…
Reference in a new issue