Skip to content

Commit 47fd9c2

Browse files
committed
docs
Signed-off-by: Nghia Tran <[email protected]>
1 parent 98ef240 commit 47fd9c2

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

modules/workqueue/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ module "workqueue" {
2121
// The number of keys to process concurrently.
2222
concurrent-work = 10
2323
24+
// Maximum number of retry attempts before a task is moved to the dead letter queue
25+
// Default is 0 (unlimited retries)
26+
max-retry = 5
27+
2428
// The name of a service that implements the workqueue GRPC service above.
2529
reconciler-service = {
2630
name = "foo"
@@ -74,6 +78,30 @@ pointing at `WORKQUEUE_SERVICE` with Cloud Run authentication (see the
7478
}
7579
```
7680

81+
## Maximum Retry and Dead Letter Queue
82+
83+
The workqueue system supports a maximum retry limit for tasks through the `max-retry` variable. When a task fails and gets requeued, the system tracks the number of attempts. Once the maximum retry limit is reached, the task is moved to a dead letter queue instead of being requeued.
84+
85+
- Setting `max-retry = 0` (the default) means unlimited retries
86+
- Setting `max-retry = 5` will move a task to the dead letter queue after 5 failed attempts
87+
88+
Tasks in the dead letter queue are stored with their original metadata plus:
89+
- A timestamp in the key name to prevent collisions
90+
- A `failed-time` metadata field indicating when the task was moved to the dead letter queue
91+
92+
Dead-lettered tasks can be inspected using standard GCS tools. They are stored in the workqueue bucket under the `dead-letter/` prefix.
93+
94+
```hcl
95+
module "workqueue" {
96+
source = "chainguard-dev/common/infra//modules/workqueue"
97+
98+
# ... other configuration ...
99+
100+
// Maximum retry limit (5 attempts before moving to dead letter queue)
101+
max-retry = 5
102+
}
103+
```
104+
77105

78106
<!-- BEGIN_TF_DOCS -->
79107
## Requirements
@@ -138,6 +166,7 @@ No requirements.
138166
| Name | Description | Type | Default | Required |
139167
|------|-------------|------|---------|:--------:|
140168
| <a name="input_concurrent-work"></a> [concurrent-work](#input\_concurrent-work) | The amount of concurrent work to dispatch at a given time. | `number` | n/a | yes |
169+
| <a name="input_max-retry"></a> [max-retry](#input\_max-retry) | The maximum number of retry attempts before a task is moved to the dead letter queue. Default of 0 means unlimited retries. | `number` | `0` | no |
141170
| <a name="input_name"></a> [name](#input\_name) | n/a | `string` | n/a | yes |
142171
| <a name="input_notification_channels"></a> [notification\_channels](#input\_notification\_channels) | List of notification channels to alert. | `list(string)` | n/a | yes |
143172
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | n/a | `string` | n/a | yes |

0 commit comments

Comments
 (0)