• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

uber / cadence / 0187fdd2-f4a4-4c9a-97b4-6604937bf7be

09 May 2023 12:23AM UTC coverage: 57.253% (-0.002%) from 57.255%
0187fdd2-f4a4-4c9a-97b4-6604937bf7be

Pull #5252

buildkite

David Porter
Merge branch 'master' into feature/zonal-partitioning
Pull Request #5252: Feature/zonal partitioning

1460 of 1460 new or added lines in 51 files covered. (100.0%)

86909 of 151799 relevant lines covered (57.25%)

2482.17 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

3.28
/client/admin/retryableClient.go
1
// Copyright (c) 2017 Uber Technologies, Inc.
2
//
3
// Permission is hereby granted, free of charge, to any person obtaining a copy
4
// of this software and associated documentation files (the "Software"), to deal
5
// in the Software without restriction, including without limitation the rights
6
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
// copies of the Software, and to permit persons to whom the Software is
8
// furnished to do so, subject to the following conditions:
9
//
10
// The above copyright notice and this permission notice shall be included in
11
// all copies or substantial portions of the Software.
12
//
13
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
// THE SOFTWARE.
20

21
package admin
22

23
import (
24
        "context"
25

26
        "go.uber.org/yarpc"
27

28
        "github.com/uber/cadence/common/backoff"
29
        "github.com/uber/cadence/common/types"
30
)
31

32
var _ Client = (*retryableClient)(nil)
33

34
type retryableClient struct {
35
        client        Client
36
        throttleRetry *backoff.ThrottleRetry
37
}
38

39
// NewRetryableClient creates a new instance of Client with retry policy
40
func NewRetryableClient(client Client, policy backoff.RetryPolicy, isRetryable backoff.IsRetryable) Client {
51✔
41
        return &retryableClient{
51✔
42
                client: client,
51✔
43
                throttleRetry: backoff.NewThrottleRetry(
51✔
44
                        backoff.WithRetryPolicy(policy),
51✔
45
                        backoff.WithRetryableError(isRetryable),
51✔
46
                ),
51✔
47
        }
51✔
48
}
51✔
49

50
func (c *retryableClient) AddSearchAttribute(
51
        ctx context.Context,
52
        request *types.AddSearchAttributeRequest,
53
        opts ...yarpc.CallOption,
54
) error {
×
55

×
56
        op := func() error {
×
57
                return c.client.AddSearchAttribute(ctx, request, opts...)
×
58
        }
×
59
        return c.throttleRetry.Do(ctx, op)
×
60
}
61

62
func (c *retryableClient) DescribeShardDistribution(
63
        ctx context.Context,
64
        request *types.DescribeShardDistributionRequest,
65
        opts ...yarpc.CallOption,
66
) (*types.DescribeShardDistributionResponse, error) {
×
67

×
68
        var resp *types.DescribeShardDistributionResponse
×
69
        op := func() error {
×
70
                var err error
×
71
                resp, err = c.client.DescribeShardDistribution(ctx, request, opts...)
×
72
                return err
×
73
        }
×
74
        err := c.throttleRetry.Do(ctx, op)
×
75
        return resp, err
×
76
}
77

78
func (c *retryableClient) DescribeHistoryHost(
79
        ctx context.Context,
80
        request *types.DescribeHistoryHostRequest,
81
        opts ...yarpc.CallOption,
82
) (*types.DescribeHistoryHostResponse, error) {
×
83

×
84
        var resp *types.DescribeHistoryHostResponse
×
85
        op := func() error {
×
86
                var err error
×
87
                resp, err = c.client.DescribeHistoryHost(ctx, request, opts...)
×
88
                return err
×
89
        }
×
90
        err := c.throttleRetry.Do(ctx, op)
×
91
        return resp, err
×
92
}
93

94
func (c *retryableClient) RemoveTask(
95
        ctx context.Context,
96
        request *types.RemoveTaskRequest,
97
        opts ...yarpc.CallOption,
98
) error {
×
99

×
100
        op := func() error {
×
101
                return c.client.RemoveTask(ctx, request, opts...)
×
102
        }
×
103
        return c.throttleRetry.Do(ctx, op)
×
104
}
105

106
func (c *retryableClient) CloseShard(
107
        ctx context.Context,
108
        request *types.CloseShardRequest,
109
        opts ...yarpc.CallOption,
110
) error {
×
111

×
112
        op := func() error {
×
113
                return c.client.CloseShard(ctx, request, opts...)
×
114
        }
×
115
        return c.throttleRetry.Do(ctx, op)
×
116
}
117

118
func (c *retryableClient) ResetQueue(
119
        ctx context.Context,
120
        request *types.ResetQueueRequest,
121
        opts ...yarpc.CallOption,
122
) error {
×
123

×
124
        op := func() error {
×
125
                return c.client.ResetQueue(ctx, request, opts...)
×
126
        }
×
127
        return c.throttleRetry.Do(ctx, op)
×
128
}
129

130
func (c *retryableClient) DescribeQueue(
131
        ctx context.Context,
132
        request *types.DescribeQueueRequest,
133
        opts ...yarpc.CallOption,
134
) (*types.DescribeQueueResponse, error) {
×
135

×
136
        var resp *types.DescribeQueueResponse
×
137
        op := func() error {
×
138
                var err error
×
139
                resp, err = c.client.DescribeQueue(ctx, request, opts...)
×
140
                return err
×
141
        }
×
142
        err := c.throttleRetry.Do(ctx, op)
×
143
        return resp, err
×
144
}
145

146
func (c *retryableClient) DescribeWorkflowExecution(
147
        ctx context.Context,
148
        request *types.AdminDescribeWorkflowExecutionRequest,
149
        opts ...yarpc.CallOption,
150
) (*types.AdminDescribeWorkflowExecutionResponse, error) {
×
151

×
152
        var resp *types.AdminDescribeWorkflowExecutionResponse
×
153
        op := func() error {
×
154
                var err error
×
155
                resp, err = c.client.DescribeWorkflowExecution(ctx, request, opts...)
×
156
                return err
×
157
        }
×
158
        err := c.throttleRetry.Do(ctx, op)
×
159
        return resp, err
×
160
}
161

162
func (c *retryableClient) GetWorkflowExecutionRawHistoryV2(
163
        ctx context.Context,
164
        request *types.GetWorkflowExecutionRawHistoryV2Request,
165
        opts ...yarpc.CallOption,
166
) (*types.GetWorkflowExecutionRawHistoryV2Response, error) {
×
167

×
168
        var resp *types.GetWorkflowExecutionRawHistoryV2Response
×
169
        op := func() error {
×
170
                var err error
×
171
                resp, err = c.client.GetWorkflowExecutionRawHistoryV2(ctx, request, opts...)
×
172
                return err
×
173
        }
×
174
        err := c.throttleRetry.Do(ctx, op)
×
175
        return resp, err
×
176
}
177

178
func (c *retryableClient) DescribeCluster(
179
        ctx context.Context,
180
        opts ...yarpc.CallOption,
181
) (*types.DescribeClusterResponse, error) {
×
182

×
183
        var resp *types.DescribeClusterResponse
×
184
        op := func() error {
×
185
                var err error
×
186
                resp, err = c.client.DescribeCluster(ctx, opts...)
×
187
                return err
×
188
        }
×
189
        err := c.throttleRetry.Do(ctx, op)
×
190
        return resp, err
×
191
}
192

193
func (c *retryableClient) GetReplicationMessages(
194
        ctx context.Context,
195
        request *types.GetReplicationMessagesRequest,
196
        opts ...yarpc.CallOption,
197
) (*types.GetReplicationMessagesResponse, error) {
×
198
        var resp *types.GetReplicationMessagesResponse
×
199
        op := func() error {
×
200
                var err error
×
201
                resp, err = c.client.GetReplicationMessages(ctx, request, opts...)
×
202
                return err
×
203
        }
×
204
        err := c.throttleRetry.Do(ctx, op)
×
205
        return resp, err
×
206
}
207

208
func (c *retryableClient) GetDomainReplicationMessages(
209
        ctx context.Context,
210
        request *types.GetDomainReplicationMessagesRequest,
211
        opts ...yarpc.CallOption,
212
) (*types.GetDomainReplicationMessagesResponse, error) {
×
213
        var resp *types.GetDomainReplicationMessagesResponse
×
214
        op := func() error {
×
215
                var err error
×
216
                resp, err = c.client.GetDomainReplicationMessages(ctx, request, opts...)
×
217
                return err
×
218
        }
×
219
        err := c.throttleRetry.Do(ctx, op)
×
220
        return resp, err
×
221
}
222

223
func (c *retryableClient) GetDLQReplicationMessages(
224
        ctx context.Context,
225
        request *types.GetDLQReplicationMessagesRequest,
226
        opts ...yarpc.CallOption,
227
) (*types.GetDLQReplicationMessagesResponse, error) {
×
228
        var resp *types.GetDLQReplicationMessagesResponse
×
229
        op := func() error {
×
230
                var err error
×
231
                resp, err = c.client.GetDLQReplicationMessages(ctx, request, opts...)
×
232
                return err
×
233
        }
×
234
        err := c.throttleRetry.Do(ctx, op)
×
235
        return resp, err
×
236
}
237

238
func (c *retryableClient) ReapplyEvents(
239
        ctx context.Context,
240
        request *types.ReapplyEventsRequest,
241
        opts ...yarpc.CallOption,
242
) error {
×
243

×
244
        op := func() error {
×
245
                return c.client.ReapplyEvents(ctx, request, opts...)
×
246
        }
×
247
        return c.throttleRetry.Do(ctx, op)
×
248
}
249

250
func (c *retryableClient) CountDLQMessages(
251
        ctx context.Context,
252
        request *types.CountDLQMessagesRequest,
253
        opts ...yarpc.CallOption,
254
) (*types.CountDLQMessagesResponse, error) {
×
255

×
256
        var resp *types.CountDLQMessagesResponse
×
257
        op := func() error {
×
258
                var err error
×
259
                resp, err = c.client.CountDLQMessages(ctx, request, opts...)
×
260
                return err
×
261
        }
×
262
        err := c.throttleRetry.Do(ctx, op)
×
263
        return resp, err
×
264
}
265

266
func (c *retryableClient) ReadDLQMessages(
267
        ctx context.Context,
268
        request *types.ReadDLQMessagesRequest,
269
        opts ...yarpc.CallOption,
270
) (*types.ReadDLQMessagesResponse, error) {
×
271

×
272
        var resp *types.ReadDLQMessagesResponse
×
273
        op := func() error {
×
274
                var err error
×
275
                resp, err = c.client.ReadDLQMessages(ctx, request, opts...)
×
276
                return err
×
277
        }
×
278
        err := c.throttleRetry.Do(ctx, op)
×
279
        return resp, err
×
280
}
281

282
func (c *retryableClient) PurgeDLQMessages(
283
        ctx context.Context,
284
        request *types.PurgeDLQMessagesRequest,
285
        opts ...yarpc.CallOption,
286
) error {
×
287

×
288
        op := func() error {
×
289
                return c.client.PurgeDLQMessages(ctx, request, opts...)
×
290
        }
×
291
        return c.throttleRetry.Do(ctx, op)
×
292
}
293

294
func (c *retryableClient) MergeDLQMessages(
295
        ctx context.Context,
296
        request *types.MergeDLQMessagesRequest,
297
        opts ...yarpc.CallOption,
298
) (*types.MergeDLQMessagesResponse, error) {
×
299

×
300
        var resp *types.MergeDLQMessagesResponse
×
301
        op := func() error {
×
302
                var err error
×
303
                resp, err = c.client.MergeDLQMessages(ctx, request, opts...)
×
304
                return err
×
305
        }
×
306
        err := c.throttleRetry.Do(ctx, op)
×
307
        return resp, err
×
308
}
309

310
func (c *retryableClient) RefreshWorkflowTasks(
311
        ctx context.Context,
312
        request *types.RefreshWorkflowTasksRequest,
313
        opts ...yarpc.CallOption,
314
) error {
×
315

×
316
        op := func() error {
×
317
                return c.client.RefreshWorkflowTasks(ctx, request, opts...)
×
318
        }
×
319
        return c.throttleRetry.Do(ctx, op)
×
320
}
321

322
func (c *retryableClient) ResendReplicationTasks(
323
        ctx context.Context,
324
        request *types.ResendReplicationTasksRequest,
325
        opts ...yarpc.CallOption,
326
) error {
×
327

×
328
        op := func() error {
×
329
                return c.client.ResendReplicationTasks(ctx, request, opts...)
×
330
        }
×
331
        return c.throttleRetry.Do(ctx, op)
×
332
}
333

334
func (c *retryableClient) GetCrossClusterTasks(
335
        ctx context.Context,
336
        request *types.GetCrossClusterTasksRequest,
337
        opts ...yarpc.CallOption,
338
) (*types.GetCrossClusterTasksResponse, error) {
×
339
        var resp *types.GetCrossClusterTasksResponse
×
340
        op := func() error {
×
341
                var err error
×
342
                resp, err = c.client.GetCrossClusterTasks(ctx, request, opts...)
×
343
                return err
×
344
        }
×
345
        err := c.throttleRetry.Do(ctx, op)
×
346
        return resp, err
×
347
}
348

349
func (c *retryableClient) RespondCrossClusterTasksCompleted(
350
        ctx context.Context,
351
        request *types.RespondCrossClusterTasksCompletedRequest,
352
        opts ...yarpc.CallOption,
353
) (*types.RespondCrossClusterTasksCompletedResponse, error) {
×
354
        var resp *types.RespondCrossClusterTasksCompletedResponse
×
355
        op := func() error {
×
356
                var err error
×
357
                resp, err = c.client.RespondCrossClusterTasksCompleted(ctx, request, opts...)
×
358
                return err
×
359
        }
×
360

361
        err := c.throttleRetry.Do(ctx, op)
×
362
        return resp, err
×
363
}
364

365
func (c *retryableClient) GetDynamicConfig(
366
        ctx context.Context,
367
        request *types.GetDynamicConfigRequest,
368
        opts ...yarpc.CallOption,
369
) (*types.GetDynamicConfigResponse, error) {
×
370
        var resp *types.GetDynamicConfigResponse
×
371
        op := func() error {
×
372
                var err error
×
373
                resp, err = c.client.GetDynamicConfig(ctx, request, opts...)
×
374
                return err
×
375
        }
×
376
        err := c.throttleRetry.Do(ctx, op)
×
377
        return resp, err
×
378
}
379

380
func (c *retryableClient) UpdateDynamicConfig(
381
        ctx context.Context,
382
        request *types.UpdateDynamicConfigRequest,
383
        opts ...yarpc.CallOption,
384
) error {
×
385
        op := func() error {
×
386
                return c.client.UpdateDynamicConfig(ctx, request, opts...)
×
387
        }
×
388
        return c.throttleRetry.Do(ctx, op)
×
389
}
390

391
func (c *retryableClient) RestoreDynamicConfig(
392
        ctx context.Context,
393
        request *types.RestoreDynamicConfigRequest,
394
        opts ...yarpc.CallOption,
395
) error {
×
396
        op := func() error {
×
397
                return c.client.RestoreDynamicConfig(ctx, request, opts...)
×
398
        }
×
399
        return c.throttleRetry.Do(ctx, op)
×
400
}
401

402
func (c *retryableClient) DeleteWorkflow(
403
        ctx context.Context,
404
        request *types.AdminDeleteWorkflowRequest,
405
        opts ...yarpc.CallOption,
406
) (*types.AdminDeleteWorkflowResponse, error) {
×
407
        var resp *types.AdminDeleteWorkflowResponse
×
408
        op := func() error {
×
409
                var err error
×
410
                resp, err = c.client.DeleteWorkflow(ctx, request, opts...)
×
411
                return err
×
412
        }
×
413
        err := c.throttleRetry.Do(ctx, op)
×
414
        return resp, err
×
415
}
416

417
func (c *retryableClient) MaintainCorruptWorkflow(
418
        ctx context.Context,
419
        request *types.AdminMaintainWorkflowRequest,
420
        opts ...yarpc.CallOption,
421
) (*types.AdminMaintainWorkflowResponse, error) {
×
422
        var resp *types.AdminMaintainWorkflowResponse
×
423
        op := func() error {
×
424
                var err error
×
425
                resp, err = c.client.MaintainCorruptWorkflow(ctx, request, opts...)
×
426
                return err
×
427
        }
×
428
        err := c.throttleRetry.Do(ctx, op)
×
429
        return resp, err
×
430
}
431

432
func (c *retryableClient) ListDynamicConfig(
433
        ctx context.Context,
434
        request *types.ListDynamicConfigRequest,
435
        opts ...yarpc.CallOption,
436
) (*types.ListDynamicConfigResponse, error) {
×
437
        var resp *types.ListDynamicConfigResponse
×
438
        op := func() error {
×
439
                var err error
×
440
                resp, err = c.client.ListDynamicConfig(ctx, request, opts...)
×
441
                return err
×
442
        }
×
443
        err := c.throttleRetry.Do(ctx, op)
×
444
        return resp, err
×
445
}
446

447
func (c *retryableClient) GetGlobalIsolationGroups(
448
        ctx context.Context,
449
        request *types.GetGlobalIsolationGroupsRequest,
450
        opts ...yarpc.CallOption,
451
) (*types.GetGlobalIsolationGroupsResponse, error) {
×
452
        var resp *types.GetGlobalIsolationGroupsResponse
×
453
        op := func() error {
×
454
                var err error
×
455
                resp, err = c.client.GetGlobalIsolationGroups(ctx, request, opts...)
×
456
                return err
×
457
        }
×
458
        err := c.throttleRetry.Do(ctx, op)
×
459
        return resp, err
×
460
}
461

462
func (c *retryableClient) UpdateGlobalIsolationGroups(
463
        ctx context.Context,
464
        request *types.UpdateGlobalIsolationGroupsRequest,
465
        opts ...yarpc.CallOption,
466
) (*types.UpdateGlobalIsolationGroupsResponse, error) {
×
467
        var resp *types.UpdateGlobalIsolationGroupsResponse
×
468
        op := func() error {
×
469
                var err error
×
470
                resp, err = c.client.UpdateGlobalIsolationGroups(ctx, request, opts...)
×
471
                return err
×
472
        }
×
473
        err := c.throttleRetry.Do(ctx, op)
×
474
        return resp, err
×
475
}
476

477
func (c *retryableClient) GetDomainIsolationGroups(
478
        ctx context.Context,
479
        request *types.GetDomainIsolationGroupsRequest,
480
        opts ...yarpc.CallOption,
481
) (*types.GetDomainIsolationGroupsResponse, error) {
×
482
        var resp *types.GetDomainIsolationGroupsResponse
×
483
        op := func() error {
×
484
                var err error
×
485
                resp, err = c.client.GetDomainIsolationGroups(ctx, request, opts...)
×
486
                return err
×
487
        }
×
488
        err := c.throttleRetry.Do(ctx, op)
×
489
        return resp, err
×
490
}
491

492
func (c *retryableClient) UpdateDomainIsolationGroups(
493
        ctx context.Context,
494
        request *types.UpdateDomainIsolationGroupsRequest,
495
        opts ...yarpc.CallOption,
496
) (*types.UpdateDomainIsolationGroupsResponse, error) {
×
497
        var resp *types.UpdateDomainIsolationGroupsResponse
×
498
        op := func() error {
×
499
                var err error
×
500
                resp, err = c.client.UpdateDomainIsolationGroups(ctx, request, opts...)
×
501
                return err
×
502
        }
×
503
        err := c.throttleRetry.Do(ctx, op)
×
504
        return resp, err
×
505
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc