From 3dfbaa99a6730c8072fd08f1d661a1e8152f6e12 Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman <the@jeffreyfreeman.me> Date: Wed, 6 Mar 2024 19:35:19 -0500 Subject: [PATCH] Fixed DEADLINE_EXCEEDED error in sendNote lambda --- CHANGELOG.md | 2 ++ api/activitypub/sendNote.ts | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 604e7219d..0f4b5b47d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ * Fixed pseudocode not rendering properly due to element `p` overflow setting. * Added the ability for the `git-heatmap` to combine activity from multiple sources. +* Fixed `DEADLINE_EXCEEDED` error which occasionally occured when calling + sendNote. ## 2.1.0 diff --git a/api/activitypub/sendNote.ts b/api/activitypub/sendNote.ts index 0315a3207..86f0579be 100644 --- a/api/activitypub/sendNote.ts +++ b/api/activitypub/sendNote.ts @@ -5,6 +5,8 @@ import { OrderedCollection } from 'activitypub-core-types/lib/activitypub/index. import { sendSignedRequest } from '../../lib/activitypub/utils/sendSignedRequest.js'; import { fetchActorInformation } from '../../lib/activitypub/utils/fetchActorInformation.js'; +export const maxDuration = 300; // This function can run for a maximum of 5 minutes + process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; if (!admin.default.apps.length) { @@ -120,7 +122,7 @@ export default async function (req: VercelRequest, res: VercelResponse) { configRef.set({ "sentIds": newSentIds, "lastEpoch": new Date().getTime() - }); + }).then(result => response.status(200)); console.log("sendNode successful", sentIds, sendingIds, newSentIds); -- GitLab