Skip to main content

Overview

Certain errors will be automatically retried 2 times by default, with a short exponential backoff.

Default Retry Behavior

By default, the SDK retries all:
  • Connection errors
  • 408 Request Timeout
  • 409 Conflict
  • 429 Rate Limit
  • ≥500 Internal errors
The default number of retries is 2, with a short exponential backoff between attempts.

Configuring Retries

You can use the WithMaxRetries option to configure or disable automatic retries.

Configure Default Retries for All Requests

// Configure the default for all requests:
client := gcore.NewClient(
	option.WithMaxRetries(0), // default is 2
)

Override Retries Per Request

// Override per-request:
client.Cloud.Projects.New(
	context.TODO(),
	cloud.ProjectNewParams{
		Name: "my-project",
	},
	option.WithMaxRetries(5),
)
Setting WithMaxRetries(0) will disable automatic retries completely.

Best Practices

  • Use higher retry counts for operations that are naturally idempotent
  • Consider disabling retries for time-sensitive operations
  • Combine with timeout configuration to control overall request duration

Build docs developers (and LLMs) love