diff --git a/inngest-spring-boot-demo/src/main/java/com/inngest/springbootdemo/testfunctions/ThrottledFunction.java b/inngest-spring-boot-demo/src/main/java/com/inngest/springbootdemo/testfunctions/ThrottledFunction.java index f21bd957..595fc2b8 100644 --- a/inngest-spring-boot-demo/src/main/java/com/inngest/springbootdemo/testfunctions/ThrottledFunction.java +++ b/inngest-spring-boot-demo/src/main/java/com/inngest/springbootdemo/testfunctions/ThrottledFunction.java @@ -17,7 +17,7 @@ public InngestFunctionConfigBuilder config(InngestFunctionConfigBuilder builder) .id("ThrottledFunction") .name("Throttled Function") .triggerEvent("test/throttled") - .throttle(1, Duration.ofSeconds(10), 1, "throttled"); + .throttle(1, Duration.ofSeconds(10), "throttled", 1); } @Override diff --git a/inngest/src/main/kotlin/com/inngest/InngestFunctionConfigBuilder.kt b/inngest/src/main/kotlin/com/inngest/InngestFunctionConfigBuilder.kt index 9078bd01..291ec000 100644 --- a/inngest/src/main/kotlin/com/inngest/InngestFunctionConfigBuilder.kt +++ b/inngest/src/main/kotlin/com/inngest/InngestFunctionConfigBuilder.kt @@ -134,17 +134,17 @@ class InngestFunctionConfigBuilder { * @param limit The total number of runs allowed to start within the given period. The limit is applied evenly over the period. * @param period The period of time for the rate limit. Run starts are evenly spaced through the given period. * The minimum granularity is 1 second. - * @param burst The number of runs allowed to start in the given window in a single burst. - * A burst > 1 bypasses smoothing for the burst and allows many runs to start at once, if desired. Defaults to 1, which disables bursting. * @param key An optional expression which returns a throttling key for controlling throttling. * Every unique key is its own throttle limit. Event data may be used within this expression, eg "event.data.user_id". + * @param burst The number of runs allowed to start in the given window in a single burst. + * A burst > 1 bypasses smoothing for the burst and allows many runs to start at once, if desired. Defaults to 1, which disables bursting. */ @JvmOverloads fun throttle( limit: Int, period: Duration, - burst: Int? = null, key: String? = null, + burst: Int? = null, ): InngestFunctionConfigBuilder = apply { this.throttle = Throttle(limit, period, key, burst) } private fun buildSteps(serveUrl: String): Map { @@ -245,7 +245,7 @@ internal data class Throttle @Json(serializeNull = false) val key: String? = null, @Json(serializeNull = false) - val burst: Int? = 1, + val burst: Int? = null, ) internal data class BatchEvents