aboutsummaryrefslogtreecommitdiff
path: root/zenserver/upstream/upstreamcache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'zenserver/upstream/upstreamcache.cpp')
-rw-r--r--zenserver/upstream/upstreamcache.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/zenserver/upstream/upstreamcache.cpp b/zenserver/upstream/upstreamcache.cpp
index 726ef331d..065471c07 100644
--- a/zenserver/upstream/upstreamcache.cpp
+++ b/zenserver/upstream/upstreamcache.cpp
@@ -286,7 +286,12 @@ namespace detail {
}
}
- return {.Bytes = Result.Bytes, .ElapsedSeconds = Result.ElapsedSeconds, .Success = Result.Success};
+ m_HealthOk = Result.ErrorCode == 0;
+
+ return {.Reason = std::move(Result.Reason),
+ .Bytes = Result.Bytes,
+ .ElapsedSeconds = Result.ElapsedSeconds,
+ .Success = Result.Success};
}
else
{
@@ -312,6 +317,8 @@ namespace detail {
BlobResult = Session.PutCompressedBlob(CacheRecord.PayloadIds[Idx], Payloads[Idx]);
}
+ m_HealthOk = BlobResult.ErrorCode == 0;
+
if (!BlobResult.Success)
{
OutReason = "upload payload '{}' FAILED, reason '{}'"_format(PayloadId, BlobResult.Reason);
@@ -332,6 +339,8 @@ namespace detail {
Session.PutRef(CacheRecord.CacheKey.Bucket, CacheRecord.CacheKey.Hash, RecordValue, ZenContentType::kCbObject);
}
+ m_HealthOk = RefResult.ErrorCode == 0;
+
if (!RefResult.Success)
{
return {.Reason = "upload cache record '{}/{}' FAILED, reason '{}'"_format(CacheRecord.CacheKey.Bucket,
@@ -351,6 +360,7 @@ namespace detail {
const IoHash RefHash = IoHash::HashBuffer(RecordValue);
FinalizeRefResult FinalizeResult = Session.FinalizeRef(CacheRecord.CacheKey.Bucket, CacheRecord.CacheKey.Hash, RefHash);
+ m_HealthOk = FinalizeResult.ErrorCode == 0;
if (!FinalizeResult.Success)
{
@@ -368,6 +378,7 @@ namespace detail {
}
FinalizeResult = Session.FinalizeRef(CacheRecord.CacheKey.Bucket, CacheRecord.CacheKey.Hash, RefHash);
+ m_HealthOk = FinalizeResult.ErrorCode == 0;
if (!FinalizeResult.Success)
{
@@ -400,6 +411,7 @@ namespace detail {
}
catch (std::exception& Err)
{
+ m_HealthOk = false;
return {.Reason = std::string(Err.what()), .Success = false};
}
}
@@ -819,10 +831,10 @@ namespace detail {
.ElapsedSeconds = TotalElapsedSeconds,
.Success = Result.Success};
}
- catch (std::exception& e)
+ catch (std::exception& Err)
{
m_HealthOk = false;
- return {.Reason = std::string(e.what()), .Success = false};
+ return {.Reason = std::string(Err.what()), .Success = false};
}
}
@@ -1276,12 +1288,12 @@ private:
{
ProcessCacheRecord(std::move(CacheRecord));
}
- catch (std::exception& e)
+ catch (std::exception& Err)
{
ZEN_ERROR("upload cache record '{}/{}' FAILED, reason '{}'",
CacheRecord.CacheKey.Bucket,
CacheRecord.CacheKey.Hash,
- e.what());
+ Err.what());
}
}
@@ -1321,9 +1333,9 @@ private:
}
}
}
- catch (std::exception& e)
+ catch (std::exception& Err)
{
- ZEN_ERROR("check endpoint(s) health FAILED, reason '{}'", e.what());
+ ZEN_ERROR("check endpoint(s) health FAILED, reason '{}'", Err.what());
}
}
}