added keep alive. most of daashboard is done
This commit is contained in:
@@ -26,7 +26,7 @@ void batched_update(std::shared_ptr<clickhouse::Client> client_ptr, std::string
|
|||||||
spdlog::warn("No users to update");
|
spdlog::warn("No users to update");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const size_t batch_size = 5;
|
const size_t batch_size = 1;
|
||||||
for (size_t base_iteration = 0; base_iteration < current_users.size(); base_iteration += batch_size) {
|
for (size_t base_iteration = 0; base_iteration < current_users.size(); base_iteration += batch_size) {
|
||||||
std::vector<std::future<void>> futures_for_this_batch;
|
std::vector<std::future<void>> futures_for_this_batch;
|
||||||
|
|
||||||
@@ -162,8 +162,10 @@ int main (int argc, char *argv[]) {
|
|||||||
std::thread update_thread = std::thread { [client_shared_ptr, base_uri](){
|
std::thread update_thread = std::thread { [client_shared_ptr, base_uri](){
|
||||||
while(true){
|
while(true){
|
||||||
batched_update(client_shared_ptr, base_uri);
|
batched_update(client_shared_ptr, base_uri);
|
||||||
sleep(5*60);
|
for (size_t i = 0; i<5; i++) {
|
||||||
spdlog::info("Rerunning update cycle");
|
sleep(60);
|
||||||
|
spdlog::info("Daemon is still alive");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} };
|
} };
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ uint16_t parse_date_to_clickhouse(const std::string& date_str) {
|
|||||||
// Try to parse YYYY-MM-DD format
|
// Try to parse YYYY-MM-DD format
|
||||||
std::tm tm = {};
|
std::tm tm = {};
|
||||||
std::istringstream ss(date_str);
|
std::istringstream ss(date_str);
|
||||||
ss >> std::get_time(&tm, "%Y-%m-%d");
|
ss >> std::get_time(&tm, "%m/%d/$Y");
|
||||||
|
|
||||||
if (ss.fail()) {
|
if (ss.fail()) {
|
||||||
spdlog::warn("Failed to parse date: {}, using epoch", date_str);
|
spdlog::warn("Failed to parse date: {}, using epoch", date_str);
|
||||||
|
|||||||
Reference in New Issue
Block a user