summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-11-08 18:15:51 +0100
committerdefault <nobody@localhost>2023-11-08 18:15:51 +0100
commitb199f223e41a56c9c8e6dcf353cb64123d378879 (patch)
treea5bfa0f2f1f41525e5ab5cc006812d843b351bad /data.c
parent42629c9742beda51675cc8a9fef4b9f349ff9dd7 (diff)
Tag indexes are also purged.
Diffstat (limited to 'data.c')
-rw-r--r--data.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/data.c b/data.c
index cd9c5e7..a544d1c 100644
--- a/data.c
+++ b/data.c
@@ -2498,7 +2498,25 @@ void purge_server(void)
xs *itl_fn = xs_fmt("%s/public.idx", srv_basedir);
int itl_gc = index_gc(itl_fn);
- srv_debug(1, xs_fmt("purge: global (obj: %d, idx: %d, itl: %d)", cnt, icnt, itl_gc));
+ /* purge tag indexes */
+ xs *tag_spec = xs_fmt("%s/tag/??", srv_basedir);
+ xs *tag_dirs = xs_glob(tag_spec, 0, 0);
+ p = tag_dirs;
+
+ int tag_gc = 0;
+ while (xs_list_iter(&p, &v)) {
+ xs *spec2 = xs_fmt("%s/" "*.idx", v);
+ xs *files = xs_glob(spec2, 0, 0);
+ xs_list *p2;
+ xs_str *v2;
+
+ p2 = files;
+ while (xs_list_iter(&p2, &v2))
+ tag_gc += index_gc(v2);
+ }
+
+ srv_debug(1, xs_fmt("purge: global "
+ "(obj: %d, idx: %d, itl: %d, tag: %d)", cnt, icnt, itl_gc, tag_gc));
}