Skip to content

workqueue: add dead-letter support #817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 13, 2025

Conversation

tcnghia
Copy link
Collaborator

@tcnghia tcnghia commented May 8, 2025

No description provided.

@tcnghia tcnghia requested a review from Copilot May 8, 2025 00:14
@tcnghia tcnghia marked this pull request as draft May 8, 2025 00:14
Copy link

@Copilot 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 introduces dead-letter support to the workqueue system by adding new functionality to permanently remove tasks after a maximum number of retry attempts. Key changes include:

  • Adding new methods (Fail and GetAttempts) to the OwnedInProgressKey interface and their implementations in both in-memory and GCS-backed queues.
  • Updating dispatcher logic to optionally use Fail when a task’s retry count exceeds a configured maxRetry value.
  • Enhancing test coverage and configuration (Terraform variables and dispatcher configuration) to support maximum retry functionality.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/workqueue/interface.go Updated the interface to include Fail and GetAttempts methods.
pkg/workqueue/inmem/inmem_test.go Added conformance testing for the maximum retry behavior.
pkg/workqueue/inmem/inmem.go Provided in-memory implementations for the new methods.
pkg/workqueue/gcs/gcs_test.go Added tests to validate dead-letter behavior using maxRetry.
pkg/workqueue/gcs/gcs.go Implemented dead-letter support with metadata updates and metrics in the GCS-based queue.
pkg/workqueue/dispatcher/handler.go Extended the Handler function to accept and pass through a maxRetry value.
pkg/workqueue/dispatcher/dispatcher.go Updated dispatcher functions to handle maxRetry logic and correctly switch to Fail when needed.
pkg/workqueue/conformance/conformance.go Added a new test scenario to validate maximum retry behavior.
modules/workqueue/variables.tf Added a new Terraform variable to configure the maximum retry threshold.
modules/workqueue/dispatcher.tf Injected the maxRetry configuration into the dispatcher module.
modules/workqueue/cmd/dispatcher/main.go Updated the main dispatcher command to pass the maxRetry value to the dispatcher.

Signed-off-by: Nghia Tran <[email protected]>
@tcnghia tcnghia force-pushed the add-max-retry-workqueue branch from 93e7861 to 8367384 Compare May 8, 2025 00:26
Signed-off-by: Nghia Tran <[email protected]>
@tcnghia tcnghia force-pushed the add-max-retry-workqueue branch from 8367384 to 47fd9c2 Compare May 8, 2025 00:30
@tcnghia tcnghia marked this pull request as ready for review May 8, 2025 00:30
@tcnghia tcnghia requested a review from mattmoor May 8, 2025 00:37
@tcnghia tcnghia force-pushed the add-max-retry-workqueue branch from 87e2f4d to 2bc7b6b Compare May 12, 2025 21:34
@tcnghia tcnghia force-pushed the add-max-retry-workqueue branch from af271fa to 00b5114 Compare May 12, 2025 22:27
Signed-off-by: Nghia Tran <[email protected]>
@tcnghia tcnghia force-pushed the add-max-retry-workqueue branch from 00b5114 to a0639f1 Compare May 12, 2025 22:28
@tcnghia tcnghia merged commit a050c5a into chainguard-dev:main May 13, 2025
89 checks passed
tcnghia added a commit that referenced this pull request May 13, 2025
To leverage the metrics added in #817

---------

Signed-off-by: Nghia Tran <[email protected]>
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.

3 participants