77 "github.com/ydb-platform/ydb-go-sdk/v3/internal/db"
88 builder "github.com/ydb-platform/ydb-go-sdk/v3/internal/ratelimiter"
99 "github.com/ydb-platform/ydb-go-sdk/v3/ratelimiter"
10+ "github.com/ydb-platform/ydb-go-sdk/v3/retry"
1011)
1112
1213type lazyRatelimiter struct {
@@ -39,7 +40,9 @@ func (r *lazyRatelimiter) CreateResource(
3940 resource ratelimiter.Resource ,
4041) (err error ) {
4142 r .init ()
42- return r .client .CreateResource (ctx , coordinationNodePath , resource )
43+ return retry .Retry (ctx , false , func (ctx context.Context ) (err error ) {
44+ return r .client .CreateResource (ctx , coordinationNodePath , resource )
45+ })
4346}
4447
4548func (r * lazyRatelimiter ) AlterResource (
@@ -48,7 +51,9 @@ func (r *lazyRatelimiter) AlterResource(
4851 resource ratelimiter.Resource ,
4952) (err error ) {
5053 r .init ()
51- return r .client .AlterResource (ctx , coordinationNodePath , resource )
54+ return retry .Retry (ctx , false , func (ctx context.Context ) (err error ) {
55+ return r .client .AlterResource (ctx , coordinationNodePath , resource )
56+ })
5257}
5358
5459func (r * lazyRatelimiter ) DropResource (
@@ -57,26 +62,36 @@ func (r *lazyRatelimiter) DropResource(
5762 resourcePath string ,
5863) (err error ) {
5964 r .init ()
60- return r .client .DropResource (ctx , coordinationNodePath , resourcePath )
65+ return retry .Retry (ctx , false , func (ctx context.Context ) (err error ) {
66+ return r .client .DropResource (ctx , coordinationNodePath , resourcePath )
67+ })
6168}
6269
6370func (r * lazyRatelimiter ) ListResource (
6471 ctx context.Context ,
6572 coordinationNodePath string ,
6673 resourcePath string ,
6774 recursive bool ,
68- ) (_ []string , err error ) {
75+ ) (paths []string , err error ) {
6976 r .init ()
70- return r .client .ListResource (ctx , coordinationNodePath , resourcePath , recursive )
77+ err = retry .Retry (ctx , false , func (ctx context.Context ) (err error ) {
78+ paths , err = r .client .ListResource (ctx , coordinationNodePath , resourcePath , recursive )
79+ return err
80+ })
81+ return paths , err
7182}
7283
7384func (r * lazyRatelimiter ) DescribeResource (
7485 ctx context.Context ,
7586 coordinationNodePath string ,
7687 resourcePath string ,
77- ) (_ * ratelimiter.Resource , err error ) {
88+ ) (resource * ratelimiter.Resource , err error ) {
7889 r .init ()
79- return r .client .DescribeResource (ctx , coordinationNodePath , resourcePath )
90+ err = retry .Retry (ctx , false , func (ctx context.Context ) (err error ) {
91+ resource , err = r .client .DescribeResource (ctx , coordinationNodePath , resourcePath )
92+ return err
93+ })
94+ return resource , err
8095}
8196
8297func (r * lazyRatelimiter ) AcquireResource (
@@ -87,7 +102,9 @@ func (r *lazyRatelimiter) AcquireResource(
87102 isUsedAmount bool ,
88103) (err error ) {
89104 r .init ()
90- return r .client .AcquireResource (ctx , coordinationNodePath , resourcePath , amount , isUsedAmount )
105+ return retry .Retry (ctx , false , func (ctx context.Context ) (err error ) {
106+ return r .client .AcquireResource (ctx , coordinationNodePath , resourcePath , amount , isUsedAmount )
107+ })
91108}
92109
93110func (r * lazyRatelimiter ) init () {
0 commit comments