Maybe ordered better?

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3683 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2021-11-03 23:23:20 +00:00
parent 2fb7fceb0c
commit 308e24c9fa
3 changed files with 4 additions and 17 deletions

View File

@ -1,4 +1,5 @@
var g_wants_requests = {};
var g_database = new Database('core');
async function following(db, id) {
var o = await db.get(id + ":following");
@ -48,20 +49,6 @@ async function followingDeep(db, seed_ids, depth) {
return x;
}
var g_database = new Database('core');
async function test_following() {
try {
print("I AM", await ssb.whoami());
var result = await followingDeep(g_database, [await ssb.whoami()], 1);
print("following ", JSON.stringify(result));
} catch (e) {
print("DOH", e, e.stack);
}
}
test_following();
function get_latest_sequence_for_author(author) {
var sequence = 0;
ssb.sqlStream(
@ -78,7 +65,7 @@ function get_latest_sequence_for_author(author) {
ssb.registerConnectionsChanged(function(change, connection) {
if (change == 'add') {
var sequence = get_latest_sequence_for_author(connection.id);
connection.send_json({'name': ['createHistoryStream'], 'type': 'source', 'args': [{'id': connection.id, 'seq': sequence}]}, function(message) {
connection.send_json({'name': ['createHistoryStream'], 'type': 'source', 'args': [{'id': connection.id, 'seq': sequence, 'live': true}]}, function(message) {
ssb.storeMessage(message.message.value);
});
connection.send_json({'name': ['blobs', 'createWants'], 'type': 'source', 'args': []}, function(message) {