This commit is contained in:
Konstantin Lampalzer 2022-10-05 23:13:40 +02:00
parent d1e385a2a1
commit 1d91792c56
35 changed files with 2275 additions and 237 deletions

View file

@ -0,0 +1,35 @@
#ifndef COMPLIB_SERVER_HEALTHCHECKER_HPP
#define COMPLIB_SERVER_HEALTHCHECKER_HPP
#include <thread>
#include <chrono>
#define HEALTH_CHECK_TIMEOUT_MS 500
class HealthChecker {
public:
static HealthChecker &getInstance() {
static HealthChecker instance;
return instance;
}
HealthChecker(HealthChecker const &) = delete;
void operator=(HealthChecker const &) = delete;
void update();
private:
HealthChecker();
[[noreturn]] void check_loop();
typedef std::chrono::steady_clock clock;
std::thread check_thread;
std::chrono::time_point<clock> last_update;
bool stop_sent = false;
};
#endif //COMPLIB_SERVER_HEALTHCHECKER_HPP