mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-13 17:16:37 +08:00
fix(sever): wrong rate limiter being used for result post
also lowers limit slightly to 300 and updates the generic message to be more clear
This commit is contained in:
parent
a6232beea5
commit
6e43e1c4dc
2 changed files with 3 additions and 3 deletions
|
@ -22,7 +22,7 @@ export default s.router(resultsContract, {
|
|||
handler: async (r) => callController(ResultController.getResults)(r),
|
||||
},
|
||||
add: {
|
||||
middleware: [validateResultSavingEnabled, RateLimit.resultsTagsUpdate],
|
||||
middleware: [validateResultSavingEnabled, RateLimit.resultsAdd],
|
||||
handler: async (r) => callController(ResultController.addResult)(r),
|
||||
},
|
||||
updateTags: {
|
||||
|
|
|
@ -29,7 +29,7 @@ export const customHandler = (
|
|||
_next: NextFunction,
|
||||
_options: Options
|
||||
): void => {
|
||||
throw new MonkeyError(429, "Too many attempts, please try again later.");
|
||||
throw new MonkeyError(429, "Request limit reached, please try again later.");
|
||||
};
|
||||
|
||||
const ONE_HOUR_SECONDS = 60 * 60;
|
||||
|
@ -277,7 +277,7 @@ export const resultsGetApe = rateLimit({
|
|||
|
||||
export const resultsAdd = rateLimit({
|
||||
windowMs: ONE_HOUR_MS,
|
||||
max: 500 * REQUEST_MULTIPLIER,
|
||||
max: 300 * REQUEST_MULTIPLIER,
|
||||
keyGenerator: getKeyWithUid,
|
||||
handler: customHandler,
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue