Skip to content

Commit 5694afd

Browse files
fix: rate-limiter
1 parent 88c937e commit 5694afd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ export default class UploadPlugin extends AdminForthPlugin {
2525
// for calcualting average time
2626
this.totalCalls = 0;
2727
this.totalDuration = 0;
28+
if (this.options.generation?.rateLimit?.limit) {
2829
this.rateLimiter = new RateLimiter(this.options.generation.rateLimit?.limit)
30+
}
2931
}
3032

3133
instanceUniqueRepresentation(pluginOptions: any) : string {
@@ -347,7 +349,7 @@ export default class UploadPlugin extends AdminForthPlugin {
347349
path: `/plugin/${this.pluginInstanceId}/generate_images`,
348350
handler: async ({ body, adminUser, headers }) => {
349351
const { prompt, recordId } = body;
350-
if (this.options.generation.rateLimit?.limit) {
352+
if (this.rateLimiter) {
351353
// rate limit
352354
// const { error } = RateLimiter.checkRateLimit(
353355
// this.pluginInstanceId,

0 commit comments

Comments
 (0)