Skip to content

Commit

Permalink
Don't throttle /api/docs/{docId}/force-reload #1107 (#1197)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fflorent authored Sep 5, 2024
1 parent 16ebc32 commit 2433695
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/server/lib/DocApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2433695

Please sign in to comment.