Handle retention as a config variable

This commit is contained in:
2026-04-23 02:56:45 -05:00
parent 20862ee002
commit 025b7b8bb9
2 changed files with 4 additions and 1 deletions

View File

@@ -48,6 +48,8 @@ static int config_handler(void* user, const char* section, const char* name, con
web_refresh = result > 1 ? result : 1;
} else if (strcmp(name, "status_refresh") == 0) {
status_refresh = atoi(value);
} else if (strcmp(name, "retention") == 0) {
retention = atoi(value);
} else {
printf("Unknown configuration entry \'%s\'\n", name);
}

View File

@@ -29,6 +29,7 @@ char* daemon_banner = "";
uint32_t global_backoff = 5;
uint32_t web_refresh = 30;
uint32_t status_refresh = 30;
uint32_t retention = 86400;
int get_asset(char** buffer, const char* path, size_t* size) {
*size = 0;
@@ -211,7 +212,7 @@ mxml_node_t* generate_index() {
for (; !iterator_equals(&count_it, &peroid_end); iterator_increment(&count_it)) {
struct StatusPeroid* peroid = *(struct StatusPeroid**)iterator_get(&count_it);
if (earliest_time == 0) earliest_time = peroid->time;
else if (peroid->time <= (now - 86400000000)) {
else if (peroid->time <= (now - (long)retension * 1000000)) {
earliest_time = peroid->time;
} else col_count++;
}