Tag indexes are also purged.

This commit is contained in:
default 2023-11-08 18:15:51 +01:00
parent 42629c9742
commit b199f223e4
2 changed files with 22 additions and 4 deletions

20
data.c
View file

@ -2498,7 +2498,25 @@ void purge_server(void)
xs *itl_fn = xs_fmt("%s/public.idx", srv_basedir); xs *itl_fn = xs_fmt("%s/public.idx", srv_basedir);
int itl_gc = index_gc(itl_fn); 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));
} }

View file

@ -1028,13 +1028,13 @@ int process_auth_token(snac *snac, const xs_dict *req)
/* this counts as a 'login' */ /* this counts as a 'login' */
lastlog_write(snac, "mastoapi"); 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 else
srv_log(xs_fmt("mastoapi auth: corrupted token %s", tokid)); srv_log(xs_fmt("mastoapi auth: corrupted token '%s'", tokid));
} }
else else
srv_log(xs_fmt("mastoapi auth: invalid token %s", tokid)); srv_log(xs_fmt("mastoapi auth: invalid token '%s'", tokid));
} }
return logged_in; return logged_in;