[MOD] Verbosity levels, avatar cleanser

I have a weird bug where Parsee seems to hang on a Db request, been
tryign to figure that otu since a while but can't quite put my finger on
where.
You can have this commit, as a treat.
This commit is contained in:
LDA 2024-08-24 19:36:37 +02:00
commit 692cb8aa6f
19 changed files with 190 additions and 111 deletions

39
tools/noavatars.c Normal file
View file

@ -0,0 +1,39 @@
/* noavatars.c - Clean up the avatar cache
* ============================================================
* Under CC0, as its a rather useful example of a Parsee tool.
* See LICENSE for more information about Parsee's licensing. */
#include <Cytoplasm/Memory.h>
#include <Cytoplasm/Json.h>
#include <Cytoplasm/Log.h>
#include <Cytoplasm/Db.h>
#include <stdlib.h>
int
Main(Array *args, HashMap *env)
{
char *db_path, *exec;
Db *parsee;
exec = ArrayGet(args, 0);
if (ArraySize(args) < 2)
{
Log(LOG_ERR, "Usage: %s [DB path]", exec);
return EXIT_FAILURE;
}
db_path = ArrayGet(args, 1);
parsee = DbOpenLMDB(db_path, 8 * 1024 * 1024);
if (parsee)
{
DbDelete(parsee, 1, "avatars");
DbClose(parsee);
return EXIT_SUCCESS;
}
Log(LOG_ERR, "%s: couldn't open DB '%s'", exec, db_path);
return EXIT_FAILURE;
}