Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F112501
D8.1732324986.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D8.1732324986.diff
View Options
diff --git a/src/base/util.hpp b/src/base/util.hpp
deleted file mode 100644
--- a/src/base/util.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * This file is part of libkazv.
- * SPDX-FileCopyrightText: 2020 Tusooa Zhu
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-
-
-#pragma once
-#include "libkazv-config.hpp"
-
-#include "basejob.hpp"
-
-namespace Kazv
-{
- /// Returns whether we should retry for this (unsuccessful) event,
- /// and the suggested interval in ms before retrying from the server.
- /// If the server has not provided a suggested interval, -1 will be
- /// used to indicate that the client should choose an interval instead.
- inline std::pair<bool, int> shouldRetryFor(BaseJob::Response res) {
- bool shouldRetry = false;
- int retryAfterMs = -1;
- bool errorCodeFromJson = false;
- if (BaseJob::isBodyJson(res.body)) {
- const auto &j = jsonBody(res).get();
- if (j.contains("errcode"s)) {
- errorCodeFromJson = true;
- auto code = j["errcode"s];
- if (code == "M_LIMIT_EXCEEDED"s) {
- shouldRetry = true;
- if (j.contains("retry_after_ms"s)) {
- retryAfterMs = j["retry_after_ms"s];
- }
- }
- }
- }
- if (! errorCodeFromJson) {
- auto c = res.statusCode;
- if (c == 408 // Request Timeout
- || c == 429 // Too many requests
- || c == 500 // Internal Server Error
- || c == 502 // Bad Gateway
- || c == 503 // Service Unavailable
- || c == 504 // Gateway Timeout
- ) {
- shouldRetry = true;
- }
- }
- return {shouldRetry, retryAfterMs};
- }
-}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 22, 5:23 PM (16 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38965
Default Alt Text
D8.1732324986.diff (1 KB)
Attached To
Mode
D8: Remove unused util.hpp
Attached
Detach File
Event Timeline
Log In to Comment