mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-11-08 19:44:45 +08:00
All consumers share the same group for load balancing across partitions
This commit is contained in:
@@ -39,7 +39,8 @@ type Consumer struct {
|
|||||||
|
|
||||||
// New creates a new consumer instance
|
// New creates a new consumer instance
|
||||||
func New(cfg *config.Config, collector *metrics.Collector, id int) (*Consumer, error) {
|
func New(cfg *config.Config, collector *metrics.Collector, id int) (*Consumer, error) {
|
||||||
consumerGroup := fmt.Sprintf("%s-%d", cfg.Consumers.GroupPrefix, id)
|
// All consumers share the same group for load balancing across partitions
|
||||||
|
consumerGroup := cfg.Consumers.GroupPrefix
|
||||||
|
|
||||||
c := &Consumer{
|
c := &Consumer{
|
||||||
id: id,
|
id: id,
|
||||||
@@ -226,9 +227,9 @@ func (c *Consumer) runSaramaConsumer(ctx context.Context) {
|
|||||||
log.Printf("Consumer %d: Error consuming: %v", c.id, err)
|
log.Printf("Consumer %d: Error consuming: %v", c.id, err)
|
||||||
c.metricsCollector.RecordConsumerError()
|
c.metricsCollector.RecordConsumerError()
|
||||||
|
|
||||||
// Wait before retrying
|
// Wait briefly before retrying (reduced from 5s to 1s for faster recovery)
|
||||||
select {
|
select {
|
||||||
case <-time.After(5 * time.Second):
|
case <-time.After(1 * time.Second):
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user