From 13197317907d08260b853d18979fd494cc9843da Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 7 Sep 2023 18:01:53 +0300 Subject: [PATCH] Remove file on error --- .env | 2 +- src/Appwrite/Platform/Tasks/Backup.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.env b/.env index eeb8e5727c..93b2ab225c 100644 --- a/.env +++ b/.env @@ -34,7 +34,7 @@ _APP_CONNECTIONS_CACHE=redis_fra1_01=redis://redis:6379 _APP_CONNECTIONS_QUEUE=redis_fra1_01=redis://redis:6379 _APP_CONNECTIONS_PUBSUB=redis_fra1_01=redis://redis:6379 _APP_CONNECTIONS_STORAGE=local://localhost -_APP_CONNECTIONS_BACKUPS_STORAGE=dospaces://ACCESS:SECRET@default/backups-v1?region=fra1 +_APP_CONNECTIONS_BACKUPS_STORAGE=dospaces://DO006P96DUQVNMLTB8TP:QwxTmU1JfjWsuHecNGiDDvp1UNrMhgCnk5rvJ2FIpm0@default/backups-v1?region=fra1 _APP_STORAGE_ANTIVIRUS=disabled _APP_STORAGE_ANTIVIRUS_HOST=clamav _APP_STORAGE_ANTIVIRUS_PORT=3310 diff --git a/src/Appwrite/Platform/Tasks/Backup.php b/src/Appwrite/Platform/Tasks/Backup.php index dd44691f05..8338dbbff0 100644 --- a/src/Appwrite/Platform/Tasks/Backup.php +++ b/src/Appwrite/Platform/Tasks/Backup.php @@ -16,11 +16,10 @@ use Utopia\Validator\Text; class Backup extends Action { public const BACKUPS_PATH = '/backups'; - //public const BACKUP_INTERVAL_SECONDS = 60 * 60 * 4; // 4 hours; - public const BACKUP_INTERVAL_SECONDS = 100; + public const BACKUP_INTERVAL_SECONDS = 60 * 60 * 4; // 4 hours; public const COMPRESS_ALGORITHM = 'zstd'; // https://www.percona.com/blog/get-your-backup-to-half-of-its-size-introducing-zstd-support-in-percona-xtrabackup/ - public const CLEANUP_LOCAL_FILES_SECONDS = 60 * 60 * 24 * 1; // 2 days? - public const CLEANUP_CLOUD_FILES_SECONDS = 60 * 60 * 24 * 1; // 14 days?; + public const CLEANUP_LOCAL_FILES_SECONDS = 60 * 60 * 24 * 7; // 2 days? + public const CLEANUP_CLOUD_FILES_SECONDS = 60 * 60 * 24 * 14; // 14 days?; public const UPLOAD_CHUNK_SIZE = 5 * 1024 * 1024; // Must be greater than 5MB; protected string $filename; protected ?DSN $dsn = null; @@ -184,6 +183,7 @@ class Backup extends Action $stderr = shell_exec('tail -1 ' . $log); if (!str_contains($stderr, 'completed OK!')) { + unlink($file); throw new Exception('Backup failed: ' . $stderr); }