From b199f223e41a56c9c8e6dcf353cb64123d378879 Mon Sep 17 00:00:00 2001 From: default Date: Wed, 8 Nov 2023 18:15:51 +0100 Subject: [PATCH] Tag indexes are also purged. --- data.c | 20 +++++++++++++++++++- mastoapi.c | 6 +++--- 2 files changed, 22 insertions(+), 4 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)); } diff --git a/mastoapi.c b/mastoapi.c index 55f685c..0c94dd9 100644 --- a/mastoapi.c +++ b/mastoapi.c @@ -1028,13 +1028,13 @@ int process_auth_token(snac *snac, const xs_dict *req) /* this counts as a 'login' */ lastlog_write(snac, "mastoapi"); - srv_debug(2, xs_fmt("mastoapi auth: valid token for user %s", uid)); + srv_debug(2, xs_fmt("mastoapi auth: valid token for user '%s'", uid)); } else - srv_log(xs_fmt("mastoapi auth: corrupted token %s", tokid)); + srv_log(xs_fmt("mastoapi auth: corrupted token '%s'", tokid)); } else - srv_log(xs_fmt("mastoapi auth: invalid token %s", tokid)); + srv_log(xs_fmt("mastoapi auth: invalid token '%s'", tokid)); } return logged_in;