Skip to content

Conversation

@mrrobot47
Copy link
Member

Implement intelligent backup cleanup that only deletes old backups when
EasyDash API successfully registers the new backup. If API callback
fails, rollback the newly uploaded backup to prevent orphaned backups
in remote storage.

Key changes:

  • Add conditional cleanup based on API callback success/failure
  • Implement rollback mechanism to delete unregistered backups
  • Extend retry logic to handle connection errors (DNS, timeouts, etc.)
  • Add proper return values to API callback methods
  • Remove dead code from error handling paths
  • Optimize backup path tracking to only when dash-auth is enabled

Retry behavior:

  • Retries 5xx server errors (500-599)
  • Retries connection errors (connection refused, DNS failures, timeouts)
  • Retries HTTP 0 (no response received)
  • Does NOT retry 4xx client errors
  • Max 3 retries with 5-minute delays between attempts

Error handling improvements:

  • Changed rollback deletion failure from error to warning for consistency
  • Clear error messages distinguish between retry attempts and final failures
  • Proper "after N retries" messaging for all retryable errors

…tion

Implement intelligent backup cleanup that only deletes old backups when
EasyDash API successfully registers the new backup. If API callback
fails, rollback the newly uploaded backup to prevent orphaned backups
in remote storage.

Key changes:
- Add conditional cleanup based on API callback success/failure
- Implement rollback mechanism to delete unregistered backups
- Extend retry logic to handle connection errors (DNS, timeouts, etc.)
- Add proper return values to API callback methods
- Remove dead code from error handling paths
- Optimize backup path tracking to only when dash-auth is enabled

Retry behavior:
- Retries 5xx server errors (500-599)
- Retries connection errors (connection refused, DNS failures, timeouts)
- Retries HTTP 0 (no response received)
- Does NOT retry 4xx client errors
- Max 3 retries with 5-minute delays between attempts

Error handling improvements:
- Changed rollback deletion failure from error to warning for consistency
- Clear error messages distinguish between retry attempts and final failures
- Proper "after N retries" messaging for all retryable errors
Copilot AI review requested due to automatic review settings December 11, 2025 04:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements intelligent backup cleanup that conditionally deletes old backups based on EasyDash API callback success. When the API callback fails, the newly uploaded backup is rolled back to prevent orphaned backups in remote storage that aren't tracked by EasyDash.

Key changes:

  • Add conditional cleanup that only removes old backups after successful API registration
  • Implement rollback mechanism to delete unregistered backups when API callback fails
  • Extend retry logic to handle connection errors (DNS failures, timeouts, connection refused) in addition to 5xx errors
Comments suppressed due to low confidence (1)

src/helper/Site_Backup_Restore.php:1104

  • While $backup comes from remote directory listing which should be safe, consider adding escapeshellarg() to the sprintf format for defense in depth, similar to line 1132 where the full path is escaped. This ensures consistency in shell command construction and protects against potential injection if the backup naming format ever changes.
				$result = EE::launch( sprintf( 'rclone purge %s/%s', $this->get_rclone_config_path(), $backup ) );

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mrrobot47 mrrobot47 merged commit 58a9e94 into EasyEngine:develop Dec 11, 2025
1 of 5 checks passed
@mrrobot47 mrrobot47 deleted the feat/api-retry-cleanup branch December 11, 2025 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant