forked from MinecraftUtilities/Backend
change metric save interval
This commit is contained in:
parent
05d0aa500c
commit
6cea5a1f29
@ -25,12 +25,7 @@ public class MetricService {
|
|||||||
/**
|
/**
|
||||||
* The interval in which the metrics are saved.
|
* The interval in which the metrics are saved.
|
||||||
*/
|
*/
|
||||||
private final long saveInterval = TimeUnit.MINUTES.toMillis(1);
|
private final long saveInterval = TimeUnit.SECONDS.toMillis(15);
|
||||||
|
|
||||||
/**
|
|
||||||
* The interval in which the metrics are written to InfluxDB.
|
|
||||||
*/
|
|
||||||
private final long writeInfluxInterval = TimeUnit.SECONDS.toMillis(30);
|
|
||||||
|
|
||||||
private final WriteApiBlocking influxWriteApi;
|
private final WriteApiBlocking influxWriteApi;
|
||||||
private final MetricsRepository metricsRepository;
|
private final MetricsRepository metricsRepository;
|
||||||
@ -49,8 +44,10 @@ public class MetricService {
|
|||||||
// Load the metrics from Redis
|
// Load the metrics from Redis
|
||||||
loadMetrics();
|
loadMetrics();
|
||||||
|
|
||||||
Timer.scheduleRepeating(this::saveMetrics, saveInterval, saveInterval);
|
Timer.scheduleRepeating(() -> {
|
||||||
Timer.scheduleRepeating(this::writeToInflux, writeInfluxInterval, writeInfluxInterval);
|
saveMetrics();
|
||||||
|
writeToInflux();
|
||||||
|
}, saveInterval, saveInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user