Skip to content

Commit

Permalink
feat(parallel): support runParallel in checks and groups [sc-18210] (
Browse files Browse the repository at this point in the history
  • Loading branch information
shiini2 committed Dec 15, 2023
1 parent 48901af commit 4c52015
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
8 changes: 8 additions & 0 deletions packages/cli/src/constructs/check-group.ts
Expand Up @@ -107,6 +107,11 @@ export interface CheckGroupProps {
* Sets a retry policy for the group. Use RetryStrategyBuilder to create a retry policy.
*/
retryStrategy?: RetryStrategy
/**
* Determines whether the checks in the group should run on all selected locations in parallel or round-robin.
* See https://www.checklyhq.com/docs/monitoring/global-locations/ to learn more about scheduling strategies.
*/
runParallel?: boolean
}

/**
Expand Down Expand Up @@ -135,6 +140,7 @@ export class CheckGroup extends Construct {
browserChecks?: BrowserCheckConfig
multiStepChecks?: MultiStepCheckConfig
retryStrategy?: RetryStrategy
runParallel?: boolean

static readonly __checklyType = 'check-group'

Expand Down Expand Up @@ -173,6 +179,7 @@ export class CheckGroup extends Construct {
this.localSetupScript = props.localSetupScript
this.localTearDownScript = props.localTearDownScript
this.retryStrategy = props.retryStrategy
this.runParallel = props.runParallel
// `browserChecks` is not a CheckGroup resource property. Not present in synthesize()
this.browserChecks = props.browserChecks
const fileAbsolutePath = Session.checkFileAbsolutePath!
Expand Down Expand Up @@ -271,6 +278,7 @@ export class CheckGroup extends Construct {
apiCheckDefaults: this.apiCheckDefaults,
environmentVariables: this.environmentVariables,
retryStrategy: this.retryStrategy,
runParallel: this.runParallel,
}
}
}
8 changes: 8 additions & 0 deletions packages/cli/src/constructs/check.ts
Expand Up @@ -86,6 +86,11 @@ export interface CheckProps {
* Sets a retry policy for the check. Use RetryStrategyBuilder to create a retry policy.
*/
retryStrategy?: RetryStrategy
/**
* Determines whether the check should run on all selected locations in parallel or round-robin.
* See https://www.checklyhq.com/docs/monitoring/global-locations/ to learn more about scheduling strategies.
*/
runParallel?: boolean
}

// This is an abstract class. It shouldn't be used directly.
Expand All @@ -106,6 +111,7 @@ export abstract class Check extends Construct {
alertChannels?: Array<AlertChannel>
testOnly?: boolean
retryStrategy?: RetryStrategy
runParallel?: boolean
__checkFilePath?: string // internal variable to filter by check file name from the CLI

static readonly __checklyType = 'check'
Expand Down Expand Up @@ -142,6 +148,7 @@ export abstract class Check extends Construct {

this.testOnly = props.testOnly ?? false
this.retryStrategy = props.retryStrategy
this.runParallel = props.runParallel ?? false
this.__checkFilePath = Session.checkFilePath
}

Expand Down Expand Up @@ -218,6 +225,7 @@ export abstract class Check extends Construct {
groupId: this.groupId,
environmentVariables: this.environmentVariables,
retryStrategy: this.retryStrategy,
runParallel: this.runParallel,
}
}
}
2 changes: 1 addition & 1 deletion packages/cli/src/services/checkly-config-loader.ts
Expand Up @@ -9,7 +9,7 @@ import { ReporterType } from '../reporters/reporter'

export type CheckConfigDefaults = Pick<CheckProps, 'activated' | 'muted' | 'doubleCheck'
| 'shouldFail' | 'runtimeId' | 'locations' | 'tags' | 'frequency' | 'environmentVariables'
| 'alertChannels' | 'privateLocations' | 'retryStrategy'>
| 'alertChannels' | 'privateLocations' | 'retryStrategy' | 'runParallel'>

export type ChecklyConfig = {
/**
Expand Down

0 comments on commit 4c52015

Please sign in to comment.