Commit a0e5c112 authored by Paal Kvamme's avatar Paal Kvamme
Browse files

Expose the maximum retry count for Seismic Store requests.

parent 3546364f
Pipeline #59709 passed with stages
in 11 minutes and 1 second
......@@ -1207,7 +1207,7 @@ SeismicStoreFile::_sslogger(int priority, const std::ios& ss) const
void
SeismicStoreFile::_set_backoff(seismicdrive::SDGenericDataset* sdgd)
{
int retries = Environment::getNumericEnv("OPENZGY_SD_BACKOFF", -1);
const int retries = this->_config->_retry_count;
if (retries >= 0) {
seismicdrive::ExponentialRetryBackoffPolicy policy;
if (retries == 0) {
......
......@@ -60,6 +60,7 @@ SeismicStoreIOContext::SeismicStoreIOContext()
setRoAfterWrite(Environment::getNumericEnv("OPENZGY_RO_AFTER_WRITE", 1) > 0);
forceRoBeforeRead(Environment::getNumericEnv("OPENZGY_RO_BEFORE_READ", 0) > 0);
forceRwBeforeWrite(Environment::getNumericEnv("OPENZGY_RW_BEFORE_WRITE", 0) > 0);
retryCount(Environment::getNumericEnv("OPENZGY_SD_BACKOFF", -1));
}
std::string
......
......@@ -120,6 +120,7 @@ private:
bool _set_ro_after_write;
bool _force_ro_before_read;
bool _force_rw_before_write;
std::int32_t _retry_count;
private: // really private. Keep off.
std::int64_t _real_segsize;
......@@ -546,6 +547,19 @@ public:
return *this;
}
/**
* Maximum number of retries that SDAPI will use before concluding
* that a web service is unavailable and not just experiencing a
* transient problem. There is an exponential backoff between
* attempts. 1/2 second for the first one, then doubling for each
* attempt but never more than 32 seconds. Leaving the parameter
* unset or set to -1 will use the defaults hard coded in SDAPI.
*/
SeismicStoreIOContext& retryCount(int value)
{
this->_retry_count = value;
return *this;
}
};
/** \endcond */
......
......@@ -2390,6 +2390,10 @@ test_sderrors()
SeismicStoreIOContext context(*Test_Utils::default_sd_context());
// SDAPI should not retry a missing token, but currently there
// is a bug that does just that. Explicitly turn off retries.
context.retryCount(0);
// Neither token not token callback were provided.
context.sdtoken("", "");
must_throw("Missing access token or callback in iocontext", [&](){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment