File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -346,12 +346,13 @@ export default class UploadPlugin extends AdminForthPlugin {
346346 const { prompt, recordId } = body ;
347347 if ( this . options . generation . rateLimit ?. limit ) {
348348 // rate limit
349- const { error } = RateLimiter . checkRateLimit (
350- this . pluginInstanceId ,
351- this . options . generation . rateLimit ?. limit ,
352- this . adminforth . auth . getClientIp ( headers ) ,
353- ) ;
354- if ( error ) {
349+ // const { error } = RateLimiter.checkRateLimit(
350+ // this.pluginInstanceId,
351+ // this.options.generation.rateLimit?.limit,
352+ // this.adminforth.auth.getClientIp(headers),
353+ // );
354+ const rateLimiter = new RateLimiter ( this . options . generation . rateLimit ?. limit ) ;
355+ if ( ! rateLimiter . consume ( `${ this . pluginInstanceId } -${ this . adminforth . auth . getClientIp ( headers ) } ` ) ) {
355356 return { error : this . options . generation . rateLimit . errorMessage } ;
356357 }
357358 }
You can’t perform that action at this time.
0 commit comments