File tree Expand file tree Collapse file tree
packages/trigger-sdk/src/v3 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -180,6 +180,7 @@ function normalizeTaskConcurrency(
180180 "name" in item &&
181181 typeof item . name === "string"
182182 ) {
183+ validateConcurrencyLimitName ( item . name ) ;
183184 resourceCatalog . registerConcurrencyLimitMetadata ( item ) ;
184185 limits . push ( item . name ) ;
185186 } else if ( item && typeof item === "object" ) {
@@ -257,12 +258,16 @@ export function queue(options: QueueOptions): Queue {
257258 * });
258259 * ```
259260 */
260- export function concurrencyLimit ( options : ConcurrencyLimitOptions ) : ConcurrencyLimit {
261- if ( options . name . length === 0 || options . name . length > 122 || options . name . includes ( "/" ) ) {
261+ function validateConcurrencyLimitName ( name : string ) : void {
262+ if ( name . length === 0 || name . length > 122 || name . includes ( "/" ) ) {
262263 throw new Error (
263- `Concurrency limit "${ options . name } ": names are 1-122 characters and may not contain "/".`
264+ `Concurrency limit "${ name } ": names are 1-122 characters and may not contain "/".`
264265 ) ;
265266 }
267+ }
268+
269+ export function concurrencyLimit ( options : ConcurrencyLimitOptions ) : ConcurrencyLimit {
270+ validateConcurrencyLimitName ( options . name ) ;
266271
267272 resourceCatalog . registerConcurrencyLimitMetadata ( options ) ;
268273
You can’t perform that action at this time.
0 commit comments