summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorOleg Morozenkov <m@oleg.rocks>2023-05-11 00:31:09 +0400
committerGitHub <noreply@github.com>2023-05-11 00:31:09 +0400
commitfb7535a34947eac61419beaf7ba7937bff50c182 (patch)
treec89bca3fda15c7045e1686f4e86762a6e709cdfa /include
parentefe43f54f830702d59fb355e0503c27d6478b538 (diff)
parent6da263a5cf24503b1c87a7777bc79a2aab9d553b (diff)
Merge pull request #262 from dmikushin/repeat-http-request-on-fail
Repeat the http request on fail
Diffstat (limited to 'include')
-rw-r--r--include/tgbot/net/HttpClient.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/tgbot/net/HttpClient.h b/include/tgbot/net/HttpClient.h
index aa82c0d..1f1b2a2 100644
--- a/include/tgbot/net/HttpClient.h
+++ b/include/tgbot/net/HttpClient.h
@@ -29,6 +29,24 @@ public:
virtual std::string makeRequest(const Url& url, const std::vector<HttpReqArg>& args) const = 0;
std::int32_t _timeout = 25;
+
+ /**
+ * @brief Get the maximum number of makeRequest() retries before giving up and throwing an exception.
+ */
+ virtual int getRequestMaxRetries() const {
+ return requestMaxRetries;
+ }
+
+ /**
+ * @brief Get the makeRequest() backoff duration between retries, in seconds.
+ */
+ virtual int getRequestBackoff() const {
+ return requestBackoff;
+ }
+
+private:
+ int requestMaxRetries = 3;
+ int requestBackoff = 1;
};
}