Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
Merge pull request influxdata#472 from influxdata/cache-version
Browse files Browse the repository at this point in the history
Cache version per influxdb instance and reduce ping() calls for every…
  • Loading branch information
majst01 authored Jul 21, 2018
2 parents f8bd921 + 96580fe commit c57c09d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/org/influxdb/impl/InfluxDBImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public class InfluxDBImpl implements InfluxDB {
private final InetAddress hostAddress;
private final String username;
private final String password;
private String version;
private final Retrofit retrofit;
private final InfluxDBService influxDBService;
private BatchProcessor batchProcessor;
Expand Down Expand Up @@ -313,7 +314,10 @@ public Pong ping() {

@Override
public String version() {
return ping().getVersion();
if (version == null) {
this.version = ping().getVersion();
}
return this.version;
}

@Override
Expand Down

0 comments on commit c57c09d

Please sign in to comment.