Skip to content

Node.js based forum software built for the modern web

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

Julian Lam442e98e4da60
diff --git a/src/activitypub/index.js b/src/activitypub/index.js
index e9b114b8ad..50d4823175 100644
--- a/src/activitypub/index.js
+++ b/src/activitypub/index.js
@@ -202,6 +202,7 @@ ActivityPub.get = async (type, id, uri) => {
...headers,
Accept: 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
},
+ timeout: 5000,
});
if (!String(response.statusCode).startsWith('2')) {
diff --git a/src/upgrades/4.0.0/remote_user_urls.js b/src/upgrades/4.0.0/remote_user_urls.js
index 9469d6cf93..4c24ebe601 100644
--- a/src/upgrades/4.0.0/remote_user_urls.js
+++ b/src/upgrades/4.0.0/remote_user_urls.js
@@ -12,7 +12,14 @@ module.exports = {
method: async () => {
const batch = require('../../batch');
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 });
},
};