Skip to content
Snippets Groups Projects
Commit 3908d846 authored by Marek Vavruša's avatar Marek Vavruša
Browse files

lib/cache: cleanup

parent 0d98177e
Branches
Tags
No related merge requests found
......@@ -267,14 +267,6 @@ static int stash(knot_layer_t *ctx, knot_pkt_t *pkt)
}
/* Clear if full */
if (ret == KNOT_ESPACE) {
/*
* Commit empty transaction to make freed pages reclaimable
* (This increases the txnid)
*/
if (kr_cache_txn_begin(cache, &txn, 0) == 0) {
kr_cache_txn_commit(&txn);
}
/* Now drop the database */
if (kr_cache_txn_begin(cache, &txn, 0) == 0) {
ret = kr_cache_clear(&txn);
if (ret == 0) {
......
......@@ -99,7 +99,8 @@ static char* prune(void *env, struct kr_module *module, const char *args)
/* Commit and format result. */
char *result = NULL;
if (kr_cache_txn_commit(&txn) != 0) {
ret = kr_cache_txn_commit(&txn);
if (ret != 0) {
asprintf(&result, "{ \"pruned\": %d, \"error\": \"%s\" }", pruned, knot_strerror(ret));
} else {
asprintf(&result, "{ \"pruned\": %d }", pruned);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment