fix: add timeout on activitypub.get, tweak upgrade script

This commit is contained in:
Julian Lam
2024-04-04 12:22:13 -04:00
parent 943cef6da2
commit 442e98e4da
2 changed files with 9 additions and 1 deletions

View File

@@ -202,6 +202,7 @@ ActivityPub.get = async (type, id, uri) => {
...headers, ...headers,
Accept: 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"', Accept: 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
}, },
timeout: 5000,
}); });
if (!String(response.statusCode).startsWith('2')) { if (!String(response.statusCode).startsWith('2')) {

View File

@@ -12,7 +12,14 @@ module.exports = {
method: async () => { method: async () => {
const batch = require('../../batch'); const batch = require('../../batch');
const { progress } = this; const { progress } = this;
const interval = 5000;
await batch.processSortedSet('usersRemote:lastCrawled', async ids => await activitypub.actors.assert(ids, { update: true }), { progress }); await batch.processSortedSet('usersRemote:lastCrawled', async (ids) => {
try {
await activitypub.actors.assert(ids, { update: true });
} catch (e) {
// noop
}
}, { progress, interval });
}, },
}; };