add auto invalidation of dns cache
Some checks failed
Publish Docker Image / docker (push) Successful in 42s
deploy / deploy (push) Has been cancelled

This commit is contained in:
Lee
2024-01-03 09:46:46 +00:00
parent d841900cfb
commit 88472c81e9
3 changed files with 19 additions and 3 deletions

View File

@ -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.
*

View File

@ -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();
}
});
}
/**