[PR #1059] enhancement: allow setting config for each group #2008

Open
opened 2026-03-07 22:14:15 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hibiken/asynq/pull/1059
Author: @armistcxy
Created: 6/24/2025
Status: 🔄 Open

Base: masterHead: enhance/groupcfg


📝 Commits (1)

  • 2bf528a feat: allow setting config for each group

📊 Changes

2 files changed (+82 additions, -12 deletions)

View changed files

📝 aggregator.go (+34 -12)
📝 server.go (+48 -0)

📄 Description

This is not the final version, still need to add test TestAggregatorMultipleGroupConfigs to aggregator_test.go (though I have test through asynqmon).

Concern: if groupA has GracePeriod: 3 * time.Second, group B has GracePeriod: 4 * time.Second. Then after 6 seconds, tasks from group B can be aggregated, but it supposed to be after 4 seconds. The reason is:

interval := defaultAggregationCheckInterval // 7 * time.Second
if params.gracePeriod < interval {
    interval = params.gracePeriod
}
for _, config := range params.groupConfigs {
    interval = min(interval, config.GracePeriod)
}

... 
ticker := time.NewTicker(a.interval)
....
case t := <-ticker.C:
    a.exec(t)
}

I will work on this, but before that I need some validations or suggestions from you @kamikazechaser .

Effort for implementing #1045


🔄 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/1059 **Author:** [@armistcxy](https://github.com/armistcxy) **Created:** 6/24/2025 **Status:** 🔄 Open **Base:** `master` ← **Head:** `enhance/groupcfg` --- ### 📝 Commits (1) - [`2bf528a`](https://github.com/hibiken/asynq/commit/2bf528aeb513bcad468fe9a8a712e03db1b4bf6a) feat: allow setting config for each group ### 📊 Changes **2 files changed** (+82 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `aggregator.go` (+34 -12) 📝 `server.go` (+48 -0) </details> ### 📄 Description This is not the final version, still need to add test `TestAggregatorMultipleGroupConfigs` to `aggregator_test.go` (though I have test through asynqmon). **Concern**: if groupA has `GracePeriod: 3 * time.Second`, group B has `GracePeriod: 4 * time.Second`. Then after 6 seconds, tasks from group B can be aggregated, but it supposed to be after 4 seconds. The reason is: ```go interval := defaultAggregationCheckInterval // 7 * time.Second if params.gracePeriod < interval { interval = params.gracePeriod } for _, config := range params.groupConfigs { interval = min(interval, config.GracePeriod) } ... ticker := time.NewTicker(a.interval) .... case t := <-ticker.C: a.exec(t) } ``` I will work on this, but before that I need some validations or suggestions from you @kamikazechaser . Effort for implementing #1045 --- <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#2008
No description provided.