Skip to content

Commit 0f6f909

Browse files
committed
refactor: rename SINGLE retry strategy to SINGLE_RETRY which it now is called
1 parent adc5bff commit 0f6f909

File tree

4 files changed

+22
-17
lines changed

4 files changed

+22
-17
lines changed

packages/cli/src/constructs/check.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
FixedRetryStrategy,
1515
LinearRetryStrategy,
1616
NoRetriesRetryStrategy,
17-
SingleRetryStrategy,
17+
SingleRetryRetryStrategy,
1818
} from './retry-strategy'
1919
import { AlertEscalation } from './alert-escalation-policy'
2020
import { IncidentTrigger } from './incident'
@@ -30,7 +30,7 @@ export type CheckRetryStrategy =
3030
| LinearRetryStrategy
3131
| ExponentialRetryStrategy
3232
| FixedRetryStrategy
33-
| SingleRetryStrategy
33+
| SingleRetryRetryStrategy
3434
| NoRetriesRetryStrategy
3535

3636
/**

packages/cli/src/constructs/monitor.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ 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, SingleRetryStrategy } from './retry-strategy'
10+
import { NoRetriesRetryStrategy, RetryStrategyType, SingleRetryRetryStrategy } from './retry-strategy'
1111
import { Check, CheckProps } from './check'
1212
import { Diagnostics } from './diagnostics'
1313
import { validateRemovedDoubleCheck } from './internal/common-diagnostics'
@@ -17,7 +17,7 @@ import { InvalidPropertyValueDiagnostic } from './construct-diagnostics'
1717
* Retry strategies supported by monitors.
1818
*/
1919
export type MonitorRetryStrategy =
20-
| SingleRetryStrategy
20+
| SingleRetryRetryStrategy
2121
| NoRetriesRetryStrategy
2222

2323
export interface MonitorProps extends Omit<CheckProps, 'doubleCheck'> {
@@ -118,7 +118,7 @@ export abstract class Monitor extends Check {
118118
await super.validate(diagnostics)
119119

120120
if (this.retryStrategy) {
121-
const supported: RetryStrategyType[] = ['SINGLE', 'NO_RETRIES']
121+
const supported: RetryStrategyType[] = ['SINGLE_RETRY', 'NO_RETRIES']
122122
if (!supported.includes(this.retryStrategy.type)) {
123123
diagnostics.add(new InvalidPropertyValueDiagnostic(
124124
'retryStrategy',

packages/cli/src/constructs/retry-strategy-codegen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export function valueForRetryStrategy (genfile: GeneratedFile, strategy?: RetryS
102102
})
103103
})
104104
})
105-
case 'SINGLE':
105+
case 'SINGLE_RETRY':
106106
return expr(ident('RetryStrategyBuilder'), builder => {
107107
builder.member(ident('singleRetry'))
108108
builder.call(builder => {

packages/cli/src/constructs/retry-strategy.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
/** Available retry strategy types */
2-
export type RetryStrategyType = 'LINEAR' | 'EXPONENTIAL' | 'FIXED' | 'SINGLE' | 'NO_RETRIES'
2+
export type RetryStrategyType =
3+
| 'LINEAR'
4+
| 'EXPONENTIAL'
5+
| 'FIXED'
6+
| 'SINGLE_RETRY'
7+
| 'NO_RETRIES'
38

49
/**
510
* Conditions can be used to limit when a retry strategy applies.
@@ -18,10 +23,10 @@ export interface RetryStrategy {
1823
/**
1924
* The number of seconds to wait before the first retry attempt.
2025
* This value is used differently based on the retry strategy type:
21-
* - FIXED: Same delay for all retries
26+
* - FIXED: Same delay f'or all retries
2227
* - LINEAR: Base value that increases linearly (baseBackoffSeconds * attempt)
2328
* - EXPONENTIAL: Base value that increases exponentially (baseBackoffSeconds ^ attempt)
24-
* - SINGLE: The delay for the first and only retry
29+
* - SINGLE_RETRY: The delay for the first and only retry
2530
*
2631
* @defaultValue 60
2732
* @example
@@ -35,7 +40,7 @@ export interface RetryStrategy {
3540
* // Exponential: 5s, 25s, 125s
3641
* baseBackoffSeconds: 5
3742
*
38-
* // Single: 10s
43+
* // Single retry: 10s
3944
* baseBackoffSeconds: 10
4045
* ```
4146
*/
@@ -120,16 +125,16 @@ export interface FixedRetryStrategy extends RetryStrategy {
120125
export type FixedRetryStrategyOptions = RetryStrategyOptions
121126

122127
/**
123-
* Configuration for single retry strategies.
128+
* Configuration for single retry retry strategies.
124129
*/
125-
export interface SingleRetryStrategy extends Pick<RetryStrategy, 'type' | 'baseBackoffSeconds' | 'sameRegion'> {
126-
type: 'SINGLE'
130+
export interface SingleRetryRetryStrategy extends Pick<RetryStrategy, 'type' | 'baseBackoffSeconds' | 'sameRegion'> {
131+
type: 'SINGLE_RETRY'
127132
}
128133

129134
/**
130-
* Options for configuring single retry strategy behavior.
135+
* Options for configuring single retry retry strategy behavior.
131136
*/
132-
export type SingleRetryStrategyOptions = Pick<RetryStrategyOptions, 'baseBackoffSeconds' | 'sameRegion'>
137+
export type SingleRetryRetryStrategyOptions = Pick<RetryStrategyOptions, 'baseBackoffSeconds' | 'sameRegion'>
133138

134139
/**
135140
* Configuration for no retry retry strategies.
@@ -224,10 +229,10 @@ export class RetryStrategyBuilder {
224229
/**
225230
* A single retry will be performed.
226231
*/
227-
static singleRetry (options?: SingleRetryStrategyOptions): SingleRetryStrategy {
232+
static singleRetry (options?: SingleRetryRetryStrategyOptions): SingleRetryRetryStrategy {
228233
const { baseBackoffSeconds, sameRegion } = RetryStrategyBuilder.defaults(options)
229234
return {
230-
type: 'SINGLE',
235+
type: 'SINGLE_RETRY',
231236
baseBackoffSeconds,
232237
sameRegion,
233238
}

0 commit comments

Comments
 (0)