improved comment quality
parent
13a114baa6
commit
dc974aa35b
|
@ -50,7 +50,7 @@ public class Cleanup {
|
||||||
final long now = LocalDateTime.now().toEpochSecond(ZoneOffset.UTC);
|
final long now = LocalDateTime.now().toEpochSecond(ZoneOffset.UTC);
|
||||||
|
|
||||||
deletedFiles += RestoreableFile.applyOnFiles(root, 0L,
|
deletedFiles += RestoreableFile.applyOnFiles(root, 0L,
|
||||||
e -> log.error("An exception occurred while trying to delete an old files!", e),
|
e -> log.error("An exception occurred while trying to delete old files!", e),
|
||||||
stream -> stream.filter(f -> now - f.getCreationTime().toEpochSecond(ZoneOffset.UTC) > config.get().maxAge)
|
stream -> stream.filter(f -> now - f.getCreationTime().toEpochSecond(ZoneOffset.UTC) > config.get().maxAge)
|
||||||
.filter(f -> deleteFile(f.getFile(), ctx))
|
.filter(f -> deleteFile(f.getFile(), ctx))
|
||||||
.count()
|
.count()
|
||||||
|
|
|
@ -27,12 +27,13 @@ import java.time.Instant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs backup on a preset interval
|
* Runs backup on a preset interval
|
||||||
* <br>
|
* <br><br>
|
||||||
* The important thing to note: <br>
|
* The important thing to note: <br>
|
||||||
* In the case that <code>doBackupsOnEmptyServer == false</code> and there have been made backups with players online,
|
* The decision of whether to do a backup or not is made at the time of scheduling, that is, whenever the <code>nextBackup</code>
|
||||||
* then everyone left the backup that was scheduled with player is still going to run. So it might appear as though there
|
* flag is set. This means that even if doBackupsOnEmptyServer=false, the backup that was scheduled with players online will
|
||||||
* has been made backup with no players online despite the config. This is the expected behaviour
|
* still go thorough. <br>
|
||||||
* <br>
|
* It might appear as though there has been made a backup with no players online despite the config. This is the expected behaviour
|
||||||
|
* <br><br>
|
||||||
* Furthermore, it uses system time
|
* Furthermore, it uses system time
|
||||||
*/
|
*/
|
||||||
public class BackupScheduler {
|
public class BackupScheduler {
|
||||||
|
@ -73,7 +74,7 @@ public class BackupScheduler {
|
||||||
} else if(!config.get().doBackupsOnEmptyServer && server.getPlayerManager().getCurrentPlayerCount() == 0) {
|
} else if(!config.get().doBackupsOnEmptyServer && server.getPlayerManager().getCurrentPlayerCount() == 0) {
|
||||||
//Do the final backup. No one's on-line and doBackupsOnEmptyServer == false
|
//Do the final backup. No one's on-line and doBackupsOnEmptyServer == false
|
||||||
if(scheduled && nextBackup <= now) {
|
if(scheduled && nextBackup <= now) {
|
||||||
//Verify we hadn't done the final one and its time to do so
|
//Verify we hadn't done the final one, and it's time to do so
|
||||||
Globals.INSTANCE.getQueueExecutor().submit(
|
Globals.INSTANCE.getQueueExecutor().submit(
|
||||||
MakeBackupRunnableFactory.create(
|
MakeBackupRunnableFactory.create(
|
||||||
BackupContext.Builder
|
BackupContext.Builder
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class RestoreHelper {
|
||||||
|
|
||||||
Optional<RestoreableFile> optionalFile =
|
Optional<RestoreableFile> optionalFile =
|
||||||
RestoreableFile.applyOnFiles(root, Optional.empty(),
|
RestoreableFile.applyOnFiles(root, Optional.empty(),
|
||||||
e -> log.error("An error occurred while trying to lock file!", e),
|
e -> log.error("An exception occurred while trying to lock the file!", e),
|
||||||
s -> s.filter(rf -> rf.getCreationTime().equals(backupTime))
|
s -> s.filter(rf -> rf.getCreationTime().equals(backupTime))
|
||||||
.findFirst());
|
.findFirst());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue