ssb: Dispatch blob wants immediately when added as the result of a web request.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 32m24s

This commit is contained in:
2025-05-22 10:56:30 -04:00
parent 996f9abaa2
commit 4931c489ed
3 changed files with 13 additions and 10 deletions

View File

@ -1116,6 +1116,7 @@ typedef struct _view_t
void* data;
size_t size;
char etag[256];
char notify_want_blob_id[k_blob_id_len];
bool not_modified;
} view_t;
@ -1175,6 +1176,7 @@ static void _httpd_endpoint_view_work(tf_ssb_t* ssb, void* user_data)
sqlite3* db = tf_ssb_acquire_db_writer(ssb);
tf_ssb_db_add_blob_wants(db, blob_id);
tf_ssb_release_db_writer(ssb, db);
snprintf(view->notify_want_blob_id, sizeof(view->notify_want_blob_id), "%s", blob_id);
}
}
}
@ -1218,6 +1220,12 @@ static void _httpd_endpoint_view_after_work(tf_ssb_t* ssb, int status, void* use
const char* k_payload = tf_http_status_text(404);
tf_http_respond(view->request, 404, NULL, 0, k_payload, strlen(k_payload));
}
if (*view->notify_want_blob_id)
{
tf_ssb_notify_blob_want_added(ssb, view->notify_want_blob_id);
}
tf_free(view->form_data);
tf_http_request_unref(view->request);
tf_free(view);