feat(lsm): sync database when closing handle

This commit is contained in:
Jef Roosens 2023-11-09 22:40:06 +01:00
parent eb0ce16f78
commit 9b223d04a0
Signed by: Jef Roosens
GPG key ID: 02D4C0997E74717B
8 changed files with 33 additions and 28 deletions

View file

@ -25,7 +25,7 @@ http_route lander_routes[] = {
.path = "^/s(l?)/([^/]*)$",
.steps = {http_loop_step_auth, lander_post_redirect_lsm,
http_loop_step_body_to_buf, lander_post_redirect_body_to_attr,
lander_entry_sync, NULL},
NULL},
.steps_res = {http_loop_step_write_header, http_loop_step_write_body,
NULL},
},
@ -33,8 +33,7 @@ http_route lander_routes[] = {
.method = http_post,
.path = "^/p(l?)/([^/]*)$",
.steps = {http_loop_step_auth, http_loop_step_parse_content_length,
lander_post_paste_lsm, lander_stream_body_to_entry,
lander_entry_sync, NULL},
lander_post_paste_lsm, lander_stream_body_to_entry, NULL},
.steps_res = {http_loop_step_write_header, http_loop_step_write_body,
NULL}},
};

View file

@ -149,17 +149,6 @@ bool lander_post_redirect_body_to_attr(event_loop_conn *conn) {
return true;
}
bool lander_entry_sync(event_loop_conn *conn) {
http_loop_ctx *ctx = conn->ctx;
lander_ctx *c_ctx = ctx->c;
if (lsm_entry_sync(c_ctx->entry) != lsm_error_ok) {
ctx->res.status = http_internal_server_error;
}
return true;
}
bool lander_post_paste_lsm(event_loop_conn *conn) {
http_loop_ctx *ctx = conn->ctx;
lander_ctx *c_ctx = ctx->c;