Retry mechanism
Updated at:
Copy as MD
The V2.0 SDK automatically retries requests that fail due to network issues. Requests that fail due to business logic errors, such as invalid parameters or nonexistent resources, are not retried and must be handled by your application.
Configuration methods
Note
RuntimeOptions settings take priority over default configurations.
-
Use the default configurations. By default, retries are disabled. If you enable retries without specifying the number of attempts, the system retries up to three times.
-
Configure retries using runtime parameters (RuntimeOptions).
use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions; // Set runtime parameters. The settings take effect only on requests that use this RuntimeOptions instance. $runtime = new RuntimeOptions([ "autoretry" => true, // Enables retries. "maxAttempts" => 3, // The maximum number of retries. ]);
Is this page helpful?