From a3e968d03e38807a676fc573770f366b0e581be9 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Tue, 18 Aug 2026 15:41:31 +0200 Subject: [PATCH] fix(backups): preserve existing volume backup timeouts Only update timeout when the API request explicitly provides one, with coverage for custom timeout values. --- app/Http/Controllers/Api/VolumeBackupsController.php | 10 +++++++--- tests/Feature/Api/VolumeBackupScheduleApiTest.php | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Api/VolumeBackupsController.php b/app/Http/Controllers/Api/VolumeBackupsController.php index a5225f5dd..26ff938a1 100644 --- a/app/Http/Controllers/Api/VolumeBackupsController.php +++ b/app/Http/Controllers/Api/VolumeBackupsController.php @@ -261,7 +261,7 @@ private function persistSchedule( string $resourceType, Model $resource, ): JsonResponse { - $backup = $storage->scheduledBackups()->updateOrCreate([], [ + $attributes = [ 'team_id' => $teamId, 'frequency' => $request->string('frequency')->toString(), 'enabled' => $request->boolean('enabled', true), @@ -275,8 +275,12 @@ private function persistSchedule( 'retention_amount_s3' => $request->integer('retention_amount_s3', 7), 'retention_days_s3' => $request->integer('retention_days_s3'), 'retention_max_storage_s3' => $request->float('retention_max_storage_s3'), - 'timeout' => $request->integer('timeout', ScheduledVolumeBackup::DEFAULT_TIMEOUT), - ]); + ]; + if ($request->has('timeout')) { + $attributes['timeout'] = $request->integer('timeout'); + } + + $backup = $storage->scheduledBackups()->updateOrCreate([], $attributes); $created = $backup->wasRecentlyCreated; auditLog('api.volume_backup.schedule_set', [ diff --git a/tests/Feature/Api/VolumeBackupScheduleApiTest.php b/tests/Feature/Api/VolumeBackupScheduleApiTest.php index 4f4bc395b..e60f2919d 100644 --- a/tests/Feature/Api/VolumeBackupScheduleApiTest.php +++ b/tests/Feature/Api/VolumeBackupScheduleApiTest.php @@ -130,6 +130,7 @@ function createVolumeBackupApiToken($context, User $user, array $abilities): str 'save_s3' => true, 'disable_local_backup' => true, 's3_storage_id' => $this->s3Storage->id, + 'timeout' => 7200, ]); $response = $this->withHeaders($this->headers) @@ -146,7 +147,8 @@ function createVolumeBackupApiToken($context, User $user, array $abilities): str ->and($backup->enabled)->toBeFalse() ->and($backup->save_s3)->toBeFalse() ->and($backup->disable_local_backup)->toBeFalse() - ->and($backup->s3_storage_id)->toBeNull(); + ->and($backup->s3_storage_id)->toBeNull() + ->and($backup->timeout)->toBe(7200); }); it('sets a directory backup schedule through the API', function () {