Skip to content

Commit

Permalink
修改归档元数据异常问题
Browse files Browse the repository at this point in the history
  • Loading branch information
majun87 committed Dec 29, 2020
1 parent 2378f6f commit db76463
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
public class ArchiveRateLimiterManager extends AbstractSubscribeRateLimiterManager {
protected static final Logger logger = LoggerFactory.getLogger(ArchiveRateLimiterManager.class);

private static final int DEFAULT_LIMIT_RATE = 1000;

private ClusterManager clusterManager;
private ArchiveConfig archiveConfig;

Expand Down Expand Up @@ -54,8 +56,10 @@ public LimiterConfig getLimiterConfig(String topic, String app, Subscription.Typ
case PRODUCTION:
if (topicConfig != null) {
Topic.TopicPolicy policy = topicConfig.getPolicy();
Integer tps = policy.getProduceArchiveTps();
if (tps == null) {
Integer tps = DEFAULT_LIMIT_RATE;
if (policy != null && policy.getProduceArchiveTps() != null) {
tps = policy.getProduceArchiveTps();
} else {
tps = defaultProducerLimitRate(topic, app);
}
if (tps <= 0) {
Expand All @@ -67,8 +71,10 @@ public LimiterConfig getLimiterConfig(String topic, String app, Subscription.Typ
case CONSUMPTION:
if (topicConfig != null) {
Topic.TopicPolicy policy = topicConfig.getPolicy();
Integer tps = policy.getConsumeArchiveTps();
if (tps == null) {
Integer tps = DEFAULT_LIMIT_RATE;
if (policy != null && policy.getConsumeArchiveTps() != null) {
tps = policy.getConsumeArchiveTps();
} else {
tps = defaultConsumerLimitRate(topic, app);
}
if (tps <= 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ public RateLimiter getOrCreate(String topic, Subscription.Type subscribe) {
public void onEvent(MetaEvent event) {
switch (event.getEventType()) {
case ADD_CONFIG: {
UpdateConfigEvent updateConfigEvent = (UpdateConfigEvent) event;
Config config = updateConfigEvent.getNewConfig();
AddConfigEvent addConfigEvent = (AddConfigEvent) event;
Config config = addConfigEvent.getConfig();
cleanRateLimiter(config);
break;
}
Expand Down

0 comments on commit db76463

Please sign in to comment.