Move expiredTagThrottleCleanup into TagThrottler class

This commit is contained in:
sfc-gh-tclinkenbeard 2022-03-02 19:28:41 -08:00
parent eb5a556c98
commit 5c053c6c37
3 changed files with 5 additions and 5 deletions

View File

@ -475,8 +475,6 @@ Ratekeeper::Ratekeeper(UID id, Database db)
SERVER_KNOBS->MAX_TL_SS_VERSION_DIFFERENCE_BATCH, SERVER_KNOBS->MAX_TL_SS_VERSION_DIFFERENCE_BATCH,
SERVER_KNOBS->TARGET_DURABILITY_LAG_VERSIONS_BATCH) { SERVER_KNOBS->TARGET_DURABILITY_LAG_VERSIONS_BATCH) {
tagThrottler = std::make_unique<TagThrottler>(db, id); tagThrottler = std::make_unique<TagThrottler>(db, id);
expiredTagThrottleCleanup = recurring([this]() { ThrottleApi::expire(this->db.getReference()); },
SERVER_KNOBS->TAG_THROTTLE_EXPIRED_CLEANUP_INTERVAL);
} }
void Ratekeeper::updateCommitCostEstimation( void Ratekeeper::updateCommitCostEstimation(

View File

@ -150,8 +150,6 @@ class Ratekeeper {
Deque<double> actualTpsHistory; Deque<double> actualTpsHistory;
Optional<Key> remoteDC; Optional<Key> remoteDC;
Future<Void> expiredTagThrottleCleanup;
Ratekeeper(UID id, Database db); Ratekeeper(UID id, Database db);
Future<Void> configurationMonitor(); Future<Void> configurationMonitor();

View File

@ -383,6 +383,7 @@ class TagThrottlerImpl {
RkTagThrottleCollection throttledTags; RkTagThrottleCollection throttledTags;
uint64_t throttledTagChangeId{ 0 }; uint64_t throttledTagChangeId{ 0 };
bool autoThrottlingEnabled{ false }; bool autoThrottlingEnabled{ false };
Future<Void> expiredTagThrottleCleanup;
ACTOR static Future<Void> monitorThrottlingChanges(TagThrottlerImpl* self) { ACTOR static Future<Void> monitorThrottlingChanges(TagThrottlerImpl* self) {
state bool committed = false; state bool committed = false;
@ -524,7 +525,10 @@ class TagThrottlerImpl {
} }
public: public:
TagThrottlerImpl(Database db, UID id) : db(db), id(id) {} TagThrottlerImpl(Database db, UID id) : db(db), id(id) {
expiredTagThrottleCleanup = recurring([this]() { ThrottleApi::expire(this->db.getReference()); },
SERVER_KNOBS->TAG_THROTTLE_EXPIRED_CLEANUP_INTERVAL);
}
Future<Void> monitorThrottlingChanges() { return monitorThrottlingChanges(this); } Future<Void> monitorThrottlingChanges() { return monitorThrottlingChanges(this); }
void addRequests(TransactionTag tag, int count) { throttledTags.addRequests(tag, count); } void addRequests(TransactionTag tag, int count) { throttledTags.addRequests(tag, count); }