forked from cory/tildefriends
ssb: Dispatch blob wants immediately when added as the result of a web request.
This commit is contained in:
parent
996f9abaa2
commit
4931c489ed
@ -132,9 +132,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
<footer class="w3-center w3-xlarge w3-padding">
|
||||
<button class="w3-button w3-yellow proceed"
|
||||
>Okay</button
|
||||
>
|
||||
<button class="w3-button w3-yellow proceed">Okay</button>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -421,13 +421,10 @@ class TfElement extends LitElement {
|
||||
[JSON.stringify(Object.keys(users))]
|
||||
);
|
||||
for (let row of info) {
|
||||
users[row.author] = Object.assign(
|
||||
users[row.author],
|
||||
{
|
||||
users[row.author] = Object.assign(users[row.author], {
|
||||
seq: row.max_sequence,
|
||||
ts: row.max_ts,
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
return users;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user