add auto invalidation of dns cache
This commit is contained in:
parent
d841900cfb
commit
88472c81e9
@ -14,13 +14,13 @@ export default class Influx {
|
||||
url: Config.influx.url,
|
||||
token: Config.influx.token,
|
||||
});
|
||||
logger.info("InfluxDB initialized");
|
||||
|
||||
this.writeApi = this.influx.getWriteApi(
|
||||
Config.influx.org,
|
||||
Config.influx.bucket,
|
||||
"ms"
|
||||
);
|
||||
|
||||
logger.info("InfluxDB initialized");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -28,7 +28,7 @@ export default class Influx {
|
||||
*
|
||||
* @param point the point to write
|
||||
*/
|
||||
public async writePoint(point: Point): Promise<void> {
|
||||
public writePoint(point: Point) {
|
||||
this.writeApi.writePoint(point);
|
||||
}
|
||||
}
|
||||
|
@ -179,6 +179,15 @@ export default class Server {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidates the DNS cache for the server.
|
||||
*/
|
||||
public invalidateDns() {
|
||||
this.dnsInfo = {
|
||||
hasResolved: false,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the server.
|
||||
*
|
||||
|
@ -23,6 +23,13 @@ export default class ServerManager {
|
||||
cron.schedule(Config.pinger.pingCron, () => {
|
||||
this.pingServers();
|
||||
});
|
||||
|
||||
cron.schedule(Config.pinger.dnsInvalidationCron, () => {
|
||||
logger.info("Invalidating DNS cache for all servers");
|
||||
for (const server of this.servers) {
|
||||
server.invalidateDns();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user