Open yanshenxian opened 4 years ago
Hi yanshenxian --
It's true, the B2StorageClientFactory doesn't make it easy to change the retry policy. Sorry. The B2StorageClientFactory is fairly new and doesn't expose all of the flexibility of the rest of the SDK.
To set the B2RetryPolicy implementation to your own class with the existing code, you will need to use something like the B2StorageHttpClientBuilder and call setRetryPolicySupplier, passing a Supplier
Alternatively, if you would like to make a PR that adds setRetryPolicy() to B2StorageClientFactory, I'd be open to reviewing it. :)
thanks, ab
Hi yanshenxian --
Were those pointers helpful?
thanks, ab
@certainmagic hi thanks for your reply~
I'm using setRetryPolicy()
simply now. But sorry for have not enough time to write a functional pr...
hi yanshenxian --
It looks like your reply got truncated somewhere along the way.
ttfn, ab
Hi @yanshenxian --
Just checking in...
ttfn, ab
sdk version: 4.0.0
The default
B2RetryPolicy
wil try max 8 attempts and each time wil sleep at least 1 second.Because hard code
sleeper.sleepSeconds(waitSeconds)
written atcom.backblaze.b2.client.B2Retryer#doRetry(java.lang.String, com.backblaze.b2.client.B2AccountAuthorizationCache, com.backblaze.b2.client.B2Retryer.RetryableCallable<T>, com.backblaze.b2.client.B2RetryPolicy)
And these classes (and some parameter classes) are package accessed.
It's not easy to change the retry behavior... 😢