File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,20 @@ func WithHTTPClient(cl HTTPClient) ConfigOpt {
4343 }
4444}
4545
46+ // WithMaxRetries returns a ConfigOpt that sets the maximum number of retries.
47+ func WithMaxRetries (maxRetries int ) ConfigOpt {
48+ return func (c * Config ) {
49+ c .maxRetries = maxRetries
50+ }
51+ }
52+
53+ // WithRetryDelay returns a ConfigOpt that sets the delay between retry attempts.
54+ func WithRetryDelay (retryDelay time.Duration ) ConfigOpt {
55+ return func (c * Config ) {
56+ c .retryDelay = retryDelay
57+ }
58+ }
59+
4660// WithMaxFeeXRP returns a ConfigOpt that sets the maximum fee in XRP.
4761func WithMaxFeeXRP (maxFeeXRP float32 ) ConfigOpt {
4862 return func (c * Config ) {
Original file line number Diff line number Diff line change @@ -85,3 +85,17 @@ func TestWithTimeout(t *testing.T) {
8585
8686 require .Equal (t , timeOut , cfg .timeout )
8787}
88+
89+ func TestWithMaxRetries (t * testing.T ) {
90+ maxRetries := 5
91+ cfg , _ := NewClientConfig ("http://s1.ripple.com:51234" , WithMaxRetries (maxRetries ))
92+
93+ require .Equal (t , maxRetries , cfg .maxRetries )
94+ }
95+
96+ func TestWithRetryDelay (t * testing.T ) {
97+ retryDelay := 2 * time .Second
98+ cfg , _ := NewClientConfig ("http://s1.ripple.com:51234" , WithRetryDelay (retryDelay ))
99+
100+ require .Equal (t , retryDelay , cfg .retryDelay )
101+ }
You can’t perform that action at this time.
0 commit comments