Cloud Tasks will attempt the task max_attempts times (that is, if the
first attempt fails, then there will be max_attempts - 1 retries). Must
be >= -1.
If unspecified when the queue is created, Cloud Tasks will pick the
default.
A task will be [scheduled][google.cloud.tasks.v2.Task.schedule_time] for
retry between [min_backoff][google.cloud.tasks.v2.RetryConfig.min_backoff]
and [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] duration
after it fails, if the queue's
[RetryConfig][google.cloud.tasks.v2.RetryConfig] specifies that the task
should be retried.
If unspecified when the queue is created, Cloud Tasks will pick the
default.
max_backoff will be truncated to the nearest second.
The time between retries will double max_doublings times.
A task's retry interval starts at
[min_backoff][google.cloud.tasks.v2.RetryConfig.min_backoff], then doubles
max_doublings times, then increases linearly, and finally
retries at intervals of
[max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] up to
[max_attempts][google.cloud.tasks.v2.RetryConfig.max_attempts] times.
For example, if
[min_backoff][google.cloud.tasks.v2.RetryConfig.min_backoff] is 10s,
[max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] is 300s, and
max_doublings is 3, then the a task will first be retried in
10s. The retry interval will double three times, and then
increase linearly by 2^3 * 10s. Finally, the task will retry at
intervals of [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff]
until the task has been attempted
[max_attempts][google.cloud.tasks.v2.RetryConfig.max_attempts] times. Thus,
the requests will retry at 10s, 20s, 40s, 80s, 160s, 240s, 300s, 300s, ....
If unspecified when the queue is created, Cloud Tasks will pick the
default.
If positive, max_retry_duration specifies the time limit for
retrying a failed task, measured from when the task was first
attempted. Once max_retry_duration time has passed and the
task has been attempted
[max_attempts][google.cloud.tasks.v2.RetryConfig.max_attempts] times, no
further attempts will be made and the task will be deleted.
If zero, then the task age is unlimited.
If unspecified when the queue is created, Cloud Tasks will pick the
default.
max_retry_duration will be truncated to the nearest second.
A task will be [scheduled][google.cloud.tasks.v2.Task.schedule_time] for
retry between [min_backoff][google.cloud.tasks.v2.RetryConfig.min_backoff]
and [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] duration
after it fails, if the queue's
[RetryConfig][google.cloud.tasks.v2.RetryConfig] specifies that the task
should be retried.
If unspecified when the queue is created, Cloud Tasks will pick the
default.
min_backoff will be truncated to the nearest second.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThis document provides reference documentation for the \u003ccode\u003eRetryConfig\u003c/code\u003e class within the Google Cloud Tasks v2 API, which is used to configure retry behavior for tasks.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of the \u003ccode\u003eRetryConfig\u003c/code\u003e documentation is 3.5.0, with previous versions including 3.4.0, 3.3.0, 3.2.0, 3.1.0, 3.0.0, 2.5.0, 2.4.0, 2.3.0, and 2.2.0 also available.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eRetryConfig\u003c/code\u003e settings allow users to determine when a failed task attempt should be retried, with options including the maximum number of attempts, the minimum and maximum backoff durations, maximum doublings, and maximum retry duration.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eRetryConfig\u003c/code\u003e class implements interfaces like \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e and includes properties to adjust the retry behavior of the tasks.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eRetryConfig\u003c/code\u003e class can be constructed either with default values or by providing another instance of the \u003ccode\u003eRetryConfig\u003c/code\u003e class.\u003c/p\u003e\n"]]],[],null,["# Google Cloud Tasks v2 API - Class RetryConfig (3.5.0)\n\nVersion latestkeyboard_arrow_down\n\n- [3.5.0 (latest)](/dotnet/docs/reference/Google.Cloud.Tasks.V2/latest/Google.Cloud.Tasks.V2.RetryConfig)\n- [3.4.0](/dotnet/docs/reference/Google.Cloud.Tasks.V2/3.4.0/Google.Cloud.Tasks.V2.RetryConfig)\n- [3.3.0](/dotnet/docs/reference/Google.Cloud.Tasks.V2/3.3.0/Google.Cloud.Tasks.V2.RetryConfig)\n- [3.2.0](/dotnet/docs/reference/Google.Cloud.Tasks.V2/3.2.0/Google.Cloud.Tasks.V2.RetryConfig)\n- [3.1.0](/dotnet/docs/reference/Google.Cloud.Tasks.V2/3.1.0/Google.Cloud.Tasks.V2.RetryConfig)\n- [3.0.0](/dotnet/docs/reference/Google.Cloud.Tasks.V2/3.0.0/Google.Cloud.Tasks.V2.RetryConfig)\n- [2.5.0](/dotnet/docs/reference/Google.Cloud.Tasks.V2/2.5.0/Google.Cloud.Tasks.V2.RetryConfig)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.Tasks.V2/2.4.0/Google.Cloud.Tasks.V2.RetryConfig)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.Tasks.V2/2.3.0/Google.Cloud.Tasks.V2.RetryConfig)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.Tasks.V2/2.2.0/Google.Cloud.Tasks.V2.RetryConfig) \n\n public sealed class RetryConfig : IMessage\u003cRetryConfig\u003e, IEquatable\u003cRetryConfig\u003e, IDeepCloneable\u003cRetryConfig\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Google Cloud Tasks v2 API class RetryConfig.\n\nRetry config.\n\nThese settings determine when a failed task attempt is retried. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e RetryConfig \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[RetryConfig](/dotnet/docs/reference/Google.Cloud.Tasks.V2/latest/Google.Cloud.Tasks.V2.RetryConfig), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[RetryConfig](/dotnet/docs/reference/Google.Cloud.Tasks.V2/latest/Google.Cloud.Tasks.V2.RetryConfig), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[RetryConfig](/dotnet/docs/reference/Google.Cloud.Tasks.V2/latest/Google.Cloud.Tasks.V2.RetryConfig), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Tasks.V2](/dotnet/docs/reference/Google.Cloud.Tasks.V2/latest/Google.Cloud.Tasks.V2)\n\nAssembly\n--------\n\nGoogle.Cloud.Tasks.V2.dll\n\nConstructors\n------------\n\n### RetryConfig()\n\n public RetryConfig()\n\n### RetryConfig(RetryConfig)\n\n public RetryConfig(RetryConfig other)\n\nProperties\n----------\n\n### MaxAttempts\n\n public int MaxAttempts { get; set; }\n\nNumber of attempts per task.\n\nCloud Tasks will attempt the task `max_attempts` times (that is, if the\nfirst attempt fails, then there will be `max_attempts - 1` retries). Must\nbe \\\u003e= -1.\n\nIf unspecified when the queue is created, Cloud Tasks will pick the\ndefault.\n\n-1 indicates unlimited attempts.\n\nThis field has the same meaning as\n[task_retry_limit in\nqueue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters).\n\n### MaxBackoff\n\n public Duration MaxBackoff { get; set; }\n\nA task will be \\[scheduled\\]\\[google.cloud.tasks.v2.Task.schedule_time\\] for\nretry between \\[min_backoff\\]\\[google.cloud.tasks.v2.RetryConfig.min_backoff\\]\nand \\[max_backoff\\]\\[google.cloud.tasks.v2.RetryConfig.max_backoff\\] duration\nafter it fails, if the queue's\n\\[RetryConfig\\]\\[google.cloud.tasks.v2.RetryConfig\\] specifies that the task\nshould be retried.\n\nIf unspecified when the queue is created, Cloud Tasks will pick the\ndefault.\n\n`max_backoff` will be truncated to the nearest second.\n\nThis field has the same meaning as\n[max_backoff_seconds in\nqueue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters).\n\n### MaxDoublings\n\n public int MaxDoublings { get; set; }\n\nThe time between retries will double `max_doublings` times.\n\nA task's retry interval starts at\n\\[min_backoff\\]\\[google.cloud.tasks.v2.RetryConfig.min_backoff\\], then doubles\n`max_doublings` times, then increases linearly, and finally\nretries at intervals of\n\\[max_backoff\\]\\[google.cloud.tasks.v2.RetryConfig.max_backoff\\] up to\n\\[max_attempts\\]\\[google.cloud.tasks.v2.RetryConfig.max_attempts\\] times.\n\nFor example, if\n\\[min_backoff\\]\\[google.cloud.tasks.v2.RetryConfig.min_backoff\\] is 10s,\n\\[max_backoff\\]\\[google.cloud.tasks.v2.RetryConfig.max_backoff\\] is 300s, and\n`max_doublings` is 3, then the a task will first be retried in\n10s. The retry interval will double three times, and then\nincrease linearly by 2\\^3 \\* 10s. Finally, the task will retry at\nintervals of \\[max_backoff\\]\\[google.cloud.tasks.v2.RetryConfig.max_backoff\\]\nuntil the task has been attempted\n\\[max_attempts\\]\\[google.cloud.tasks.v2.RetryConfig.max_attempts\\] times. Thus,\nthe requests will retry at 10s, 20s, 40s, 80s, 160s, 240s, 300s, 300s, ....\n\nIf unspecified when the queue is created, Cloud Tasks will pick the\ndefault.\n\nThis field has the same meaning as\n[max_doublings in\nqueue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters).\n\n### MaxRetryDuration\n\n public Duration MaxRetryDuration { get; set; }\n\nIf positive, `max_retry_duration` specifies the time limit for\nretrying a failed task, measured from when the task was first\nattempted. Once `max_retry_duration` time has passed *and* the\ntask has been attempted\n\\[max_attempts\\]\\[google.cloud.tasks.v2.RetryConfig.max_attempts\\] times, no\nfurther attempts will be made and the task will be deleted.\n\nIf zero, then the task age is unlimited.\n\nIf unspecified when the queue is created, Cloud Tasks will pick the\ndefault.\n\n`max_retry_duration` will be truncated to the nearest second.\n\nThis field has the same meaning as\n[task_age_limit in\nqueue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters).\n\n### MinBackoff\n\n public Duration MinBackoff { get; set; }\n\nA task will be \\[scheduled\\]\\[google.cloud.tasks.v2.Task.schedule_time\\] for\nretry between \\[min_backoff\\]\\[google.cloud.tasks.v2.RetryConfig.min_backoff\\]\nand \\[max_backoff\\]\\[google.cloud.tasks.v2.RetryConfig.max_backoff\\] duration\nafter it fails, if the queue's\n\\[RetryConfig\\]\\[google.cloud.tasks.v2.RetryConfig\\] specifies that the task\nshould be retried.\n\nIf unspecified when the queue is created, Cloud Tasks will pick the\ndefault.\n\n`min_backoff` will be truncated to the nearest second.\n\nThis field has the same meaning as\n[min_backoff_seconds in\nqueue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters)."]]