-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from skrud-dt/use-taskTimeout
feat!: use taskTimeout in SempahoreTimeoutOptions
- Loading branch information
Showing
9 changed files
with
222 additions
and
46 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ const project = new awscdk.AwsCdkConstructLibrary({ | |
author: 'Ej Wang', | ||
authorAddress: '[email protected]', | ||
|
||
cdkVersion: '2.10.0', | ||
cdkVersion: '2.63.0', | ||
|
||
autoApproveOptions: { | ||
allowedUsernames: ['flyingImer'], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Duration } from 'aws-cdk-lib'; | ||
import { Timeout } from 'aws-cdk-lib/aws-stepfunctions'; | ||
|
||
export interface SemaphoreTimeoutOptions { | ||
/** | ||
* Maximum run time for the execution. | ||
* | ||
* @deprecated Use taskTimeout instead | ||
* @default No timeout | ||
*/ | ||
readonly timeout?: Duration; | ||
/** | ||
* Maximum run time for the execution. | ||
* @default No timeout | ||
*/ | ||
readonly taskTimeout?: Timeout; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { isPositiveInteger, JsonPath } from 'aws-cdk-lib/aws-stepfunctions'; | ||
import { isPositiveInteger, JsonPath, Timeout } from 'aws-cdk-lib/aws-stepfunctions'; | ||
import { SemaphoreTimeoutOptions } from './types'; | ||
|
||
/** | ||
* Check if the given literal string is a non negative integer value at compile time. | ||
|
@@ -11,4 +12,14 @@ export const isDeterminedNonNegativeInteger = (value: string): boolean => { | |
} | ||
const num = new Number(value); | ||
return !Number.isNaN(num) && isPositiveInteger(num.valueOf()); | ||
}; | ||
}; | ||
|
||
/** | ||
* As of [email protected], `timeout` is a deprecated parameter | ||
* and we should be using taskTimeout instead. | ||
* | ||
* @param props SemaphoreTimeoutOptions | ||
* @returns A value for `taskTimeout` | ||
*/ | ||
export const toTaskTimeout = ({ taskTimeout, timeout }: SemaphoreTimeoutOptions): undefined | Timeout => | ||
taskTimeout ?? (timeout ? Timeout.duration(timeout) : undefined); |
Oops, something went wrong.