Rise
The Vieneo Province
Loading...
Searching...
No Matches
DiagnosticUploadBudget.h
Go to the documentation of this file.
1#pragma once
2#include <cstdint>
3
4// Keep routine diagnostics from turning a repeated error into a queue of full
5// trace files. Fatal reports and explicit trace requests do not use this budget.
7{
8 std::uint64_t nextSend = 0;
9 std::uint32_t pendingReceipt = 0;
10
11public:
12 bool CanSend(std::uint64_t now) const { return !pendingReceipt && now >= nextSend; }
13 void Sent(std::uint64_t now, std::uint32_t receipt)
14 {
15 nextSend = now + 60000;
16 pendingReceipt = receipt;
17 }
18 void Confirm(std::uint32_t receipt)
19 {
20 if (receipt && receipt == pendingReceipt) pendingReceipt = 0;
21 }
23};
void Sent(std::uint64_t now, std::uint32_t receipt)
void Confirm(std::uint32_t receipt)
bool CanSend(std::uint64_t now) const