Skip to content

Commit

Permalink
fix: rate limit streaming prediction
Browse files Browse the repository at this point in the history
  • Loading branch information
alarv committed Dec 19, 2024
1 parent 53e01a5 commit db9ae59
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/kotlin/org/jaqpot/api/service/model/ModelService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,11 @@ class ModelService(
throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Unknown dataset type", null)
}

@PreAuthorize("@predictModelAuthorizationLogic.decide(#root, #modelId)")
@WithRateLimitProtectionByUser(
limit = 30,
intervalInSeconds = 60 * 60
) // 30 requests per hour, up to 100 predictions per request
fun streamPredictWithModel(
modelId: Long,
datasetId: Long,
Expand Down

0 comments on commit db9ae59

Please sign in to comment.