mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 19:55:10 +00:00
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.
39 lines
900 B
C
39 lines
900 B
C
/* 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;
|
|
}
|