Skip to content

Commit

Permalink
formate code
Browse files Browse the repository at this point in the history
  • Loading branch information
gaoyan1998 committed Dec 12, 2023
1 parent dfd8516 commit d96f7dc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.util.concurrent.CompletableFuture;

import cn.hutool.core.text.StrFormatter;
import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;

/**
Expand All @@ -56,20 +55,21 @@ public static MetricsContextHolder getInstances() {

public void sendAsync(String key, MetricsVO o) {
CompletableFuture.runAsync(() -> {
metricsVOS.add(o);
long duration = System.currentTimeMillis() - lastDumpTime;
synchronized (metricsVOS) {
if (metricsVOS.size() > 1000 || duration > 1000 * 5) {
PaimonUtil.write(PaimonTableConstant.DINKY_METRICS, metricsVOS, MetricsVO.class);
metricsVOS.clear();
}
}
String topic = StrFormatter.format("{}/{}", SseTopic.METRICS.getValue(), key);
SseSessionContextHolder.sendTopic(topic, o);
}).whenComplete((v, t) -> {
if (t!= null) {
log.error("send metrics async error", t);
}
});
metricsVOS.add(o);
long duration = System.currentTimeMillis() - lastDumpTime;
synchronized (metricsVOS) {
if (metricsVOS.size() > 1000 || duration > 1000 * 5) {
PaimonUtil.write(PaimonTableConstant.DINKY_METRICS, metricsVOS, MetricsVO.class);
metricsVOS.clear();
}
}
String topic = StrFormatter.format("{}/{}", SseTopic.METRICS.getValue(), key);
SseSessionContextHolder.sendTopic(topic, o);
})
.whenComplete((v, t) -> {
if (t != null) {
log.error("send metrics async error", t);
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

package org.dinky.data.metrics;

import java.io.Serializable;

import cn.hutool.core.lang.Singleton;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

@Getter
@Setter
public class MetricsTotal implements Serializable {
Expand Down

0 comments on commit d96f7dc

Please sign in to comment.