RetryWithRefreshedResource updates the resource before invoking the cb
( ctx context.Context, cli client.Client, resource client.Object, cb func() error, )
| 31 | |
| 32 | // RetryWithRefreshedResource updates the resource before invoking the cb |
| 33 | func RetryWithRefreshedResource( |
| 34 | ctx context.Context, |
| 35 | cli client.Client, |
| 36 | resource client.Object, |
| 37 | cb func() error, |
| 38 | ) error { |
| 39 | return retry.OnError(retry.DefaultBackoff, RetryAlways, func() error { |
| 40 | if err := cli.Get(ctx, client.ObjectKeyFromObject(resource), resource); err != nil { |
| 41 | return err |
| 42 | } |
| 43 | |
| 44 | return cb() |
| 45 | }) |
| 46 | } |
no test coverage detected