Skip to content

Commit 2e26f2a

Browse files
committed
feat: add all retry strategies to monitors, since they will be limited by plan instead
1 parent 1d9015c commit 2e26f2a

File tree

1 file changed

+10
-27
lines changed

1 file changed

+10
-27
lines changed

packages/cli/src/constructs/monitor.ts

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,24 @@ import { CheckGroupV2 } from './check-group-v2'
77
import { Frequency } from './frequency'
88
import { IncidentTrigger } from './incident'
99
import { PrivateLocation, PrivateLocationRef } from './private-location'
10-
import { NoRetriesRetryStrategy, RetryStrategyType, SingleRetryRetryStrategy } from './retry-strategy'
10+
import {
11+
ExponentialRetryStrategy,
12+
FixedRetryStrategy,
13+
LinearRetryStrategy,
14+
NoRetriesRetryStrategy,
15+
SingleRetryRetryStrategy,
16+
} from './retry-strategy'
1117
import { Check, CheckProps } from './check'
1218
import { Diagnostics } from './diagnostics'
1319
import { validateRemovedDoubleCheck } from './internal/common-diagnostics'
14-
import { InvalidPropertyValueDiagnostic } from './construct-diagnostics'
1520

1621
/**
1722
* Retry strategies supported by monitors.
1823
*/
1924
export type MonitorRetryStrategy =
25+
| LinearRetryStrategy
26+
| ExponentialRetryStrategy
27+
| FixedRetryStrategy
2028
| SingleRetryRetryStrategy
2129
| NoRetriesRetryStrategy
2230

@@ -83,8 +91,6 @@ export interface MonitorProps extends Omit<CheckProps, 'doubleCheck'> {
8391
* Sets a retry policy for the monitor. Use RetryStrategyBuilder to create a
8492
* suitable retry strategy.
8593
*
86-
* Note that monitors only support a single retry.
87-
*
8894
* @example
8995
* ```typescript
9096
* // Single retry
@@ -114,29 +120,6 @@ export abstract class Monitor extends Check {
114120
await validateRemovedDoubleCheck(diagnostics, this)
115121
}
116122

117-
async validate (diagnostics: Diagnostics): Promise<void> {
118-
await super.validate(diagnostics)
119-
120-
if (this.retryStrategy) {
121-
const supported: RetryStrategyType[] = ['SINGLE_RETRY', 'NO_RETRIES']
122-
if (!supported.includes(this.retryStrategy.type)) {
123-
diagnostics.add(new InvalidPropertyValueDiagnostic(
124-
'retryStrategy',
125-
new Error(
126-
`Monitors only support a single retry. The following options `
127-
+ `are available:`
128-
+ `\n\n`
129-
+ ` // Single retry\n`
130-
+ ` RetryStrategyBuilder.singleRetry()`
131-
+ `\n\n`
132-
+ ` // No retries\n`
133-
+ ` RetryStrategyBuilder.noRetries()`,
134-
),
135-
))
136-
}
137-
}
138-
}
139-
140123
synthesize () {
141124
return {
142125
...super.synthesize(),

0 commit comments

Comments
 (0)