Skip to content
This repository was archived by the owner on Jun 4, 2026. It is now read-only.

Commit d0f3eae

Browse files
committed
Minor change on the CI/CD setup
1 parent b0feb18 commit d0f3eae

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

src/mm_scan.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,31 @@
66
#include "mm_sha256.h"
77
#include "mm_util.h"
88

9+
static const time_t MM_MIN_CANDIDATE_AGE_SECONDS = 30;
10+
911
static int mm_compare_candidates(const void *left, const void *right) {
1012
const mm_image_candidate_t *a = left;
1113
const mm_image_candidate_t *b = right;
1214
return strcmp(a->source_path, b->source_path);
1315
}
1416

17+
static bool mm_candidate_is_old_enough(const struct stat *st) {
18+
time_t now;
19+
double age_seconds;
20+
21+
if (!st)
22+
return false;
23+
24+
now = time(NULL);
25+
if (now == (time_t)-1) {
26+
mm_log_warn("SCAN", "failed to get current time while checking candidate");
27+
return false;
28+
}
29+
30+
age_seconds = difftime(now, st->st_mtime);
31+
return age_seconds >= (double)MM_MIN_CANDIDATE_AGE_SECONDS;
32+
}
33+
1534
static bool mm_candidate_list_contains_source(const mm_candidate_list_t *list,
1635
const char *source_path) {
1736
size_t index;
@@ -182,6 +201,10 @@ static bool mm_scan_directory(const mm_config_t *config,
182201
continue;
183202
if (!mm_string_ends_with_ignore_case(entry->d_name, ".ffpfsc"))
184203
continue;
204+
if (!mm_candidate_is_old_enough(&st)) {
205+
mm_log_debug("SCAN", "skipping recently modified file: %s", full_path);
206+
continue;
207+
}
185208
if (mm_candidate_list_contains_source(list, full_path))
186209
continue;
187210

0 commit comments

Comments
 (0)