Skip to content

Conversation

@mrrobot47
Copy link
Member

This pull request improves the reliability and clarity of the dashboard callback logic in the Site_Backup_Restore.php helper by refining the retry mechanism and enhancing error handling and logging. The changes help ensure that retries are correctly counted and that log messages remain informative, even when responses are missing or errors occur.

Retry logic improvements:

  • Changed the retry counting in send_dash_request to use max_attempts (initial attempt plus retries) and start counting from 1 to ensure all intended attempts are made.
  • Updated the retry condition to use max_attempts for consistency and accurate logging of attempt numbers.

Error handling and logging enhancements:

  • Normalized the response output by introducing response_text, which safely handles cases where no response is received, preventing string concatenation errors in logs.
  • Improved error messaging for different failure scenarios: added handling for cURL errors, exhausted retries on 5xx errors, network issues with no HTTP response, and other HTTP error codes, all using the normalized response text.
  • Ensured all debug and warning logs use the normalized response text for clarity and consistency.

Copilot AI review requested due to automatic review settings December 8, 2025 08:21
@mrrobot47 mrrobot47 changed the title Fix bugs in API retry Enhance and stabilize API retry handling Dec 8, 2025
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 fixes critical bugs in the API retry mechanism for the EasyEngine Dashboard callback functionality. The previous implementation had an off-by-one error that would have caused only 3 total attempts instead of the intended 4 (1 initial + 3 retries), and also had potential issues with string concatenation when cURL returned no response.

Key changes:

  • Fixed retry counting to properly execute 4 total attempts (1 initial + 3 retries) by introducing max_attempts and starting the counter at 1
  • Added response normalization to prevent concatenation errors when cURL returns false
  • Enhanced error handling with specific messages for different failure scenarios including a new edge case for http_code === 0

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

@mrrobot47 mrrobot47 merged commit 293b8fa into EasyEngine:develop Dec 8, 2025
7 of 11 checks passed
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