fix(backups): preserve existing volume backup timeouts
Only update timeout when the API request explicitly provides one, with coverage for custom timeout values.
This commit is contained in:
parent
b075693274
commit
a3e968d03e
2 changed files with 10 additions and 4 deletions
|
|
@ -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', [
|
||||
|
|
|
|||
|
|
@ -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 () {
|
||||
|
|
|
|||
Loading…
Reference in a new issue