why use tagCode to caculate the deliverTime in ScheduleMessageService of rocketMQ

24 Views Asked by At

the method executeOnTimeup of ScheduleMessageService caculate the deliverTimestamp ,if the cqUnit.isTagsCodeValid() return true the tagsCode is tag hasCode,why can use this to caculate the time

CqUnit cqUnit = bufferCQ.next();
   long offsetPy = cqUnit.getPos();
   int sizePy = cqUnit.getSize();
   long tagsCode = cqUnit.getTagsCode();
   if (!cqUnit.isTagsCodeValid()) {
         long msgStoreTime = ScheduleMessageService.this.brokerController.getMessageStore().getCommitLog().pickupStoreTimestamp(offsetPy, sizePy);
       tagsCode = computeDeliverTimestamp(delayLevel, msgStoreTime);
    }
   long now = System.currentTimeMillis();
   long deliverTimestamp = this.correctDeliverTimestamp(now, tagsCode);
1

There are 1 best solutions below

0
Jack Tsai On

This is definitely not what tagsCode is meant to be. As tagsCode in CQUnit represents the address for CQ extend files, which should not be utilized as a timestamp here. It should be another variable replacing the tagsCode usage for the deliverTimestamp here.