storage: Faster.
This commit is contained in:
parent
66234b14bc
commit
27f2d319ab
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"type": "tildefriends-app",
|
"type": "tildefriends-app",
|
||||||
"emoji": "💾",
|
"emoji": "💾",
|
||||||
"previous": "&mvGTlWKFR5QM/3nb4fJ2WQq0n/gNKvBmhGDkAvb8ki8=.sha256"
|
"previous": "&tzZFIe7Y54O4sx1QtAPdemkXh+p5qHXSG/dlS7NP6OQ=.sha256"
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ async function query(sql, args) {
|
|||||||
|
|
||||||
async function get_biggest() {
|
async function get_biggest() {
|
||||||
return query(`
|
return query(`
|
||||||
select author, sum(length(content)) as size from messages group by author order by size desc limit 10;
|
select author, size from messages_stats group by author order by size desc limit 10;
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,14 +63,15 @@ function nice_size(bytes) {
|
|||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
await app.setDocument(
|
await app.setDocument(
|
||||||
'<p style="color: #fff">Finding the top 10 largest feeds...</p>'
|
'<p style="color: #fff">Analyzing feeds...</p>'
|
||||||
);
|
);
|
||||||
let most_follows = await get_most_follows();
|
let most_follows = get_most_follows();
|
||||||
let total = await get_total();
|
let total = await get_total();
|
||||||
let identities = await ssb.getAllIdentities();
|
let identities = await ssb.getAllIdentities();
|
||||||
let following1 = await ssb.following(identities, 1);
|
let following1 = await ssb.following(identities, 1);
|
||||||
let following2 = await ssb.following(identities, 2);
|
let following2 = await ssb.following(identities, 2);
|
||||||
let biggest = await get_biggest();
|
let biggest = await get_biggest();
|
||||||
|
most_follows = await most_follows;
|
||||||
let names = await get_names(
|
let names = await get_names(
|
||||||
[].concat(
|
[].concat(
|
||||||
biggest.map((x) => x.author),
|
biggest.map((x) => x.author),
|
||||||
@ -94,7 +95,7 @@ async function main() {
|
|||||||
}
|
}
|
||||||
let html = `<body style="color: #000; background-color: #ddd">\n
|
let html = `<body style="color: #000; background-color: #ddd">\n
|
||||||
<h1>Storage Summary</h1>
|
<h1>Storage Summary</h1>
|
||||||
<h2>Top 10 Accounts by Size</h2>
|
<h2>Top Accounts by Size</h2>
|
||||||
<ol>`;
|
<ol>`;
|
||||||
for (let item of biggest) {
|
for (let item of biggest) {
|
||||||
html += `<li>
|
html += `<li>
|
||||||
@ -105,7 +106,7 @@ async function main() {
|
|||||||
}
|
}
|
||||||
html += `
|
html += `
|
||||||
</ol>
|
</ol>
|
||||||
<h2>Top 10 Accounts by Follows</h2>
|
<h2>Top Accounts by Follows</h2>
|
||||||
<ol>`;
|
<ol>`;
|
||||||
for (let item of most_follows) {
|
for (let item of most_follows) {
|
||||||
html += `<li>
|
html += `<li>
|
||||||
|
@ -950,7 +950,7 @@ bool tf_ssb_db_blob_store(tf_ssb_t* ssb, const uint8_t* blob, size_t size, char*
|
|||||||
result = r == SQLITE_DONE;
|
result = r == SQLITE_DONE;
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
tf_printf("Blob store failed: %s.", sqlite3_errmsg(db));
|
tf_printf("Blob store failed: %s.\n", sqlite3_errmsg(db));
|
||||||
}
|
}
|
||||||
rows = sqlite3_changes(db);
|
rows = sqlite3_changes(db);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user