From 243369513f220aa0b576c884b02aea0554539b1d Mon Sep 17 00:00:00 2001 From: Florent Date: Thu, 5 Sep 2024 22:36:05 +0200 Subject: [PATCH] Don't throttle /api/docs/{docId}/force-reload #1107 (#1197) When a document has too many requests, one may want to force a document to be reopened. However, the /force-reload endpoint may raise a 429 (TOO_MANY_REQUESTS) error, because it uses the throttled middleware. --- app/server/lib/DocApi.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/server/lib/DocApi.ts b/app/server/lib/DocApi.ts index 1ceef806..4aaf7934 100644 --- a/app/server/lib/DocApi.ts +++ b/app/server/lib/DocApi.ts @@ -972,11 +972,12 @@ export class DocWorkerApi { // Reload a document forcibly (in fact this closes the doc, it will be automatically // reopened on use). - this._app.post('/api/docs/:docId/force-reload', canEdit, throttled(async (req, res) => { - const activeDoc = await this._getActiveDoc(req); + this._app.post('/api/docs/:docId/force-reload', canEdit, async (req, res) => { + const mreq = req as RequestWithLogin; + const activeDoc = await this._getActiveDoc(mreq); await activeDoc.reloadDoc(); res.json(null); - })); + }); this._app.post('/api/docs/:docId/recover', canEdit, throttled(async (req, res) => { const recoveryModeRaw = req.body.recoveryMode;