Tweaking memory stats and trying to figure out why startup got so much slower.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3828 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-02-06 03:28:29 +00:00
parent fbb61581c6
commit 6b20d69976
3 changed files with 10 additions and 10 deletions

View File

@ -33,7 +33,7 @@ function following(db, id) {
}
f.sequence = row.sequence;
});
f.users = Array.from(f.users);
f.users = Array.from(f.users).sort();
var j = JSON.stringify(f);
if (o != j) {
db.set(id + ":following", j);
@ -55,11 +55,7 @@ function followingDeep(db, seed_ids, depth) {
function get_latest_sequence_for_author(author) {
var sequence = 0;
ssb.sqlStream(
'SELECT MIN(a.sequence) FROM messages a LEFT OUTER JOIN messages b ON a.author = b.author AND a.sequence + 1 = b.sequence WHERE a.author = ?1 AND b.content IS NULL',
// TODO: Should we never have allowed inserting if we couldn't
// validate previous? The query above helps us fill in gaps in
// feeds.
//'SELECT MAX(sequence) AS sequence FROM messages WHERE author = ?1',
'SELECT MAX(sequence) AS sequence FROM messages WHERE author = ?1',
[author],
function(row) {
if (row.sequence) {
@ -212,7 +208,8 @@ function ebtReplicateSendClock(request, have) {
var ids = followingDeep(g_database, [me], 2).concat([request.connection.id]);
if (!Object.keys(last_sent).length) {
for (let id of ids) {
message[id] = get_latest_sequence_for_author(id);
var sequence = get_latest_sequence_for_author(id);
message[id] = sequence ? sequence : -1;
}
}
for (let id of Object.keys(have)) {