MaxMaeder / DriveBackupV2

Uploads Minecraft backups to Google Drive/OneDrive or by (S)FTP
https://dev.bukkit.org/projects/drivebackupv2
MIT License
160 stars 49 forks source link

strengthen uploadthread #196

Closed StillGreen-san closed 1 month ago

StillGreen-san commented 2 months ago

this has a few changes to make UploadThread more resilient

getBackupStatus will now directly return strings that do not need any replacements. in the past this function has often caused exceptions when called while UploadThread was in an inconsistent state, this reduces to chance of an exception.

run has been split into run and run_internal. run_internal has the bulk of the actual upload logic. run will wrap run_internal in a try block to make sure that lastBackupSuccessful and backupStatus are properly set when encountering an exception or returning early. both of those have caused problems in the past. it also prevents UploadThread getting into an broken state with local-keep-count: 0 (resulting in an exception on further actions)