cleanup
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m19s

This commit is contained in:
Lee 2024-04-14 10:01:35 +01:00
parent 6cea5a1f29
commit 13964e0f65

@ -1,5 +1,6 @@
package xyz.mcutils.backend.service; package xyz.mcutils.backend.service;
import com.influxdb.client.InfluxDBClient;
import com.influxdb.client.WriteApiBlocking; import com.influxdb.client.WriteApiBlocking;
import com.influxdb.spring.influx.InfluxDB2AutoConfiguration; import com.influxdb.spring.influx.InfluxDB2AutoConfiguration;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
@ -32,7 +33,9 @@ public class MetricService {
@Autowired @Autowired
public MetricService(InfluxDB2AutoConfiguration influxAutoConfiguration, MetricsRepository metricsRepository) { public MetricService(InfluxDB2AutoConfiguration influxAutoConfiguration, MetricsRepository metricsRepository) {
this.influxWriteApi = influxAutoConfiguration.influxDBClient().getWriteApiBlocking(); try (InfluxDBClient client = influxAutoConfiguration.influxDBClient()) {
this.influxWriteApi = client.getWriteApiBlocking();
}
this.metricsRepository = metricsRepository; this.metricsRepository = metricsRepository;
// Register the metrics // Register the metrics