mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
test: add more logs
This commit is contained in:
@@ -118,11 +118,13 @@ Actors.assert = async (ids, options = {}) => {
|
|||||||
activitypub.helpers.log(`[activitypub/actors] Asserting ${ids.length} actor(s)`);
|
activitypub.helpers.log(`[activitypub/actors] Asserting ${ids.length} actor(s)`);
|
||||||
|
|
||||||
// NOTE: MAKE SURE EVERY DB ADDITION HAS A CORRESPONDING REMOVAL IN ACTORS.REMOVE!
|
// NOTE: MAKE SURE EVERY DB ADDITION HAS A CORRESPONDING REMOVAL IN ACTORS.REMOVE!
|
||||||
|
const start = Date.now();
|
||||||
|
|
||||||
const urlMap = new Map();
|
const urlMap = new Map();
|
||||||
const followersUrlMap = new Map();
|
const followersUrlMap = new Map();
|
||||||
const pubKeysMap = new Map();
|
const pubKeysMap = new Map();
|
||||||
const categories = new Set();
|
const categories = new Set();
|
||||||
|
console.log(' 4b9a', Date.now() - start);
|
||||||
let actors = await Promise.all(ids.map(async (id) => {
|
let actors = await Promise.all(ids.map(async (id) => {
|
||||||
try {
|
try {
|
||||||
activitypub.helpers.log(`[activitypub/actors] Processing ${id}`);
|
activitypub.helpers.log(`[activitypub/actors] Processing ${id}`);
|
||||||
@@ -198,6 +200,7 @@ Actors.assert = async (ids, options = {}) => {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
console.log(' 4b9b', Date.now() - start);
|
||||||
actors = actors.filter(Boolean); // remove unresolvable actors
|
actors = actors.filter(Boolean); // remove unresolvable actors
|
||||||
if (!actors.length && !categories.size) {
|
if (!actors.length && !categories.size) {
|
||||||
return [];
|
return [];
|
||||||
@@ -206,7 +209,7 @@ Actors.assert = async (ids, options = {}) => {
|
|||||||
// Build userData object for storage
|
// Build userData object for storage
|
||||||
const profiles = (await activitypub.mocks.profile(actors)).filter(Boolean);
|
const profiles = (await activitypub.mocks.profile(actors)).filter(Boolean);
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
|
console.log(' 4b9c', Date.now() - start);
|
||||||
const bulkSet = profiles.reduce((memo, profile) => {
|
const bulkSet = profiles.reduce((memo, profile) => {
|
||||||
const key = `userRemote:${profile.uid}`;
|
const key = `userRemote:${profile.uid}`;
|
||||||
memo.push([key, profile], [`${key}:keys`, pubKeysMap.get(profile.uid)]);
|
memo.push([key, profile], [`${key}:keys`, pubKeysMap.get(profile.uid)]);
|
||||||
@@ -245,7 +248,7 @@ Actors.assert = async (ids, options = {}) => {
|
|||||||
|
|
||||||
return memo;
|
return memo;
|
||||||
}, { searchRemove: [], searchAdd: [], handleRemove: [], handleAdd: {} });
|
}, { searchRemove: [], searchAdd: [], handleRemove: [], handleAdd: {} });
|
||||||
|
console.log(' 4b9d', Date.now() - start);
|
||||||
// Removals
|
// Removals
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
db.sortedSetRemoveBulk(queries.searchRemove),
|
db.sortedSetRemoveBulk(queries.searchRemove),
|
||||||
@@ -259,7 +262,7 @@ Actors.assert = async (ids, options = {}) => {
|
|||||||
db.sortedSetAddBulk(queries.searchAdd),
|
db.sortedSetAddBulk(queries.searchAdd),
|
||||||
db.setObject('handle:uid', queries.handleAdd),
|
db.setObject('handle:uid', queries.handleAdd),
|
||||||
]);
|
]);
|
||||||
|
console.log(' 4b9e', Date.now() - start);
|
||||||
// Handle any actors that should be asserted as a group instead
|
// Handle any actors that should be asserted as a group instead
|
||||||
if (categories.size) {
|
if (categories.size) {
|
||||||
const assertion = await Actors.assertGroup(Array.from(categories), options);
|
const assertion = await Actors.assertGroup(Array.from(categories), options);
|
||||||
@@ -271,7 +274,7 @@ Actors.assert = async (ids, options = {}) => {
|
|||||||
|
|
||||||
// otherwise, assertGroup returned true and output can be safely ignored.
|
// otherwise, assertGroup returned true and output can be safely ignored.
|
||||||
}
|
}
|
||||||
|
console.log(' 4b9f', Date.now() - start);
|
||||||
return actors;
|
return actors;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
|
|||||||
// Check recipients/audience for category (local or remote)
|
// Check recipients/audience for category (local or remote)
|
||||||
console.log(' 4b8', Date.now() - start);
|
console.log(' 4b8', Date.now() - start);
|
||||||
const set = activitypub.helpers.makeSet(_activitypub, ['to', 'cc', 'audience']);
|
const set = activitypub.helpers.makeSet(_activitypub, ['to', 'cc', 'audience']);
|
||||||
console.log(' 4b9', Date.now() - start);
|
console.log(' 4b9', Date.now() - start, Array.from(set));
|
||||||
await activitypub.actors.assert(Array.from(set));
|
await activitypub.actors.assert(Array.from(set));
|
||||||
console.log(' 4b10', Date.now() - start);
|
console.log(' 4b10', Date.now() - start);
|
||||||
// Local
|
// Local
|
||||||
|
|||||||
Reference in New Issue
Block a user