@@ -518,23 +518,23 @@ func (pc *pushConsumer) messageQueueChanged(topic string, mqAll, mqDivided []*pr
518
518
if newVal == 0 {
519
519
newVal = 1
520
520
}
521
- rlog .Info ("The PullThresholdForTopic is changed" , map [string ]interface {}{
521
+ rlog .Info ("The PullThresholdForQueue is changed" , map [string ]interface {}{
522
522
rlog .LogKeyValueChangedFrom : pc .option .PullThresholdForTopic ,
523
523
rlog .LogKeyValueChangedTo : newVal ,
524
524
})
525
- pc .option .PullThresholdForTopic = newVal
525
+ pc .option .PullThresholdForQueue . Store ( int64 ( newVal ))
526
526
}
527
527
528
528
if pc .option .PullThresholdSizeForTopic != - 1 {
529
529
newVal := pc .option .PullThresholdSizeForTopic / count
530
530
if newVal == 0 {
531
531
newVal = 1
532
532
}
533
- rlog .Info ("The PullThresholdSizeForTopic is changed" , map [string ]interface {}{
534
- rlog .LogKeyValueChangedFrom : pc .option .PullThresholdSizeForTopic ,
533
+ rlog .Info ("The PullThresholdSizeForQueue is changed" , map [string ]interface {}{
534
+ rlog .LogKeyValueChangedFrom : pc .option .PullThresholdSizeForQueue . Load () ,
535
535
rlog .LogKeyValueChangedTo : newVal ,
536
536
})
537
- pc .option .PullThresholdSizeForTopic = newVal
537
+ pc .option .PullThresholdSizeForQueue . Store ( int32 ( newVal ))
538
538
}
539
539
}
540
540
pc .client .SendHeartbeatToAllBrokerWithLock ()
@@ -564,9 +564,9 @@ func (pc *pushConsumer) validate() error {
564
564
}
565
565
}
566
566
567
- if pc .option .PullThresholdForQueue < 1 || pc .option .PullThresholdForQueue > 65535 {
568
- if pc .option .PullThresholdForQueue == 0 {
569
- pc .option .PullThresholdForQueue = 1024
567
+ if pc .option .PullThresholdForQueue . Load () < 1 || pc .option .PullThresholdForQueue . Load () > 65535 {
568
+ if pc .option .PullThresholdForQueue . Load () == 0 {
569
+ pc .option .PullThresholdForQueue . Store ( 1024 )
570
570
} else {
571
571
return errors .New ("option.PullThresholdForQueue out of range [1, 65535]" )
572
572
}
@@ -580,9 +580,9 @@ func (pc *pushConsumer) validate() error {
580
580
}
581
581
}
582
582
583
- if pc .option .PullThresholdSizeForQueue < 1 || pc .option .PullThresholdSizeForQueue > 1024 {
584
- if pc .option .PullThresholdSizeForQueue == 0 {
585
- pc .option .PullThresholdSizeForQueue = 512
583
+ if pc .option .PullThresholdSizeForQueue . Load () < 1 || pc .option .PullThresholdSizeForQueue . Load () > 1024 {
584
+ if pc .option .PullThresholdSizeForQueue . Load () == 0 {
585
+ pc .option .PullThresholdSizeForQueue . Store ( 512 )
586
586
} else {
587
587
return errors .New ("option.PullThresholdSizeForQueue out of range [1, 1024]" )
588
588
}
@@ -693,10 +693,10 @@ func (pc *pushConsumer) pullMessage(request *PullRequest) {
693
693
}
694
694
695
695
cachedMessageSizeInMiB := int (pq .cachedMsgSize .Load () / Mb )
696
- if pq .cachedMsgCount .Load () > pc .option .PullThresholdForQueue {
696
+ if pq .cachedMsgCount .Load () > pc .option .PullThresholdForQueue . Load () {
697
697
if pc .queueFlowControlTimes % 1000 == 0 {
698
698
rlog .Warning ("the cached message count exceeds the threshold, so do flow control" , map [string ]interface {}{
699
- "PullThresholdForQueue" : pc .option .PullThresholdForQueue ,
699
+ "PullThresholdForQueue" : pc .option .PullThresholdForQueue . Load () ,
700
700
"minOffset" : pq .Min (),
701
701
"maxOffset" : pq .Max (),
702
702
"count" : pq .cachedMsgCount ,
@@ -710,10 +710,10 @@ func (pc *pushConsumer) pullMessage(request *PullRequest) {
710
710
goto NEXT
711
711
}
712
712
713
- if cachedMessageSizeInMiB > pc .option .PullThresholdSizeForQueue {
713
+ if cachedMessageSizeInMiB > int ( pc .option .PullThresholdSizeForQueue . Load ()) {
714
714
if pc .queueFlowControlTimes % 1000 == 0 {
715
715
rlog .Warning ("the cached message size exceeds the threshold, so do flow control" , map [string ]interface {}{
716
- "PullThresholdSizeForQueue" : pc .option .PullThresholdSizeForQueue ,
716
+ "PullThresholdSizeForQueue" : pc .option .PullThresholdSizeForQueue . Load () ,
717
717
"minOffset" : pq .Min (),
718
718
"maxOffset" : pq .Max (),
719
719
"count" : pq .cachedMsgCount ,
0 commit comments