[PR #505] feat: add custom unique key option #2788

Open
opened 2026-03-15 21:03:24 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hibiken/asynq/pull/505
Author: @22dm
Created: 6/24/2022
Status: 🔄 Open

Base: masterHead: custom-unique-key


📝 Commits (2)

  • 519985f feat: add custom unique key option
  • 69f4dd7 Merge branch 'master' into custom-unique-key

📊 Changes

4 files changed (+85 additions, -2 deletions)

View changed files

📝 client.go (+30 -2)
📝 client_test.go (+43 -0)
📝 inspector.go (+6 -0)
📝 internal/base/base.go (+6 -0)

📄 Description

When Enqueue Unique Task, allow the user to customize the UniqueKey instead of using Task Payload by default, because the payload may contain things like trace IDs from upstream, and in some scenarios these tasks should still be considered the same task despite the differences in these fields.

The reason for not using task ID is that TTL is needed to avoid some workers quitting abnormally, making it impossible to continue the task.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hibiken/asynq/pull/505 **Author:** [@22dm](https://github.com/22dm) **Created:** 6/24/2022 **Status:** 🔄 Open **Base:** `master` ← **Head:** `custom-unique-key` --- ### 📝 Commits (2) - [`519985f`](https://github.com/hibiken/asynq/commit/519985f195d2d89ee5e9911c7411faacb7473b28) feat: add custom unique key option - [`69f4dd7`](https://github.com/hibiken/asynq/commit/69f4dd7eb072da5ceb5d95552d4239363fc5bbbb) Merge branch 'master' into custom-unique-key ### 📊 Changes **4 files changed** (+85 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `client.go` (+30 -2) 📝 `client_test.go` (+43 -0) 📝 `inspector.go` (+6 -0) 📝 `internal/base/base.go` (+6 -0) </details> ### 📄 Description When Enqueue Unique Task, allow the user to customize the UniqueKey instead of using Task Payload by default, because the payload may contain things like trace IDs from upstream, and in some scenarios these tasks should still be considered the same task despite the differences in these fields. The reason for not using task ID is that TTL is needed to avoid some workers quitting abnormally, making it impossible to continue the task. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asynq#2788
No description provided.