With most applications that connect to an API, unnecessary exceptions
can be returned back to the caller in the case of transient network or
service issues. To avoid this noctua
has implemented a
retry method with exponential backoff. This technique increases the
reliability of the application with connecting to
AWS Athena
.
noctua
’s retry?By default noctua
performs a retry noisily, this means
it will report the exception it has encountered and let the user know
how long noctua
will wait until it retries again. This is
reported in the following format:
This is to keep the user informed in what noctua
is
doing behind the scenes.
By default noctua
retries 5 times and does it noisily.
To configure this, noctua_options
has been give 2 extra
parameters retry
and retry_quiet
.
retry
is the number of retries noctua
will
perform. retry_quiet
tells noctua
to retry
quietly or not.
We can change the default retry settings so that noctua
will retry 10 times and do it quietly:
If you wish to create your own custom retry function just set the
retry
to 0:
library(DBI)
library(noctua)
# connection to AWS Athena
con = dbConnect(athena())
# Stop noctua retrying
noctua_options(retry = 0)
# build your own custom retry function
custom_retry = function(x){
# your custom retry method
}
# apply your own retry function
custom_retry(dbGetQuery(con, "select ..."))
If you wish to increase the retry functionality of
noctua
for example the use of different backoff algorithms,
please raise a ticket at issues or raise a
pull request.