Skip to content

Commit

Permalink
delayCollect->clean
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyoko-Jeremie committed Sep 1, 2023
1 parent 960e6dc commit 699e2da
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/DelayCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ namespace DelayCollection {
return di.timeClock < time;
});
}

void clean() {
std::lock_guard lg{mtx};
q.clear();
}
};

class DelayCollect : public std::enable_shared_from_this<DelayCollect> {
Expand Down Expand Up @@ -204,6 +209,21 @@ namespace DelayCollection {
historyRelayFirstDelay.removeBefore(time);
}

void cleanTcpPing() {
historyTcpPing.clean();
lastTcpPing = TimeMsInvalid;
}

void cleanHttpPing() {
historyHttpPing.clean();
lastHttpPing = TimeMsInvalid;
}

void cleanFirstDelay() {
historyRelayFirstDelay.clean();
lastRelayFirstDelay = TimeMsInvalid;
}

public:
void pushTcpPing(TimeMs t) {
lastTcpPing = t;
Expand Down
3 changes: 3 additions & 0 deletions src/StateMonitorServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,9 @@ void HttpConnectSession::path_op(HttpConnectSession::QueryPairsType &queryPairs)
a->lastOnlinePing = std::chrono::milliseconds{-1};
a->lastConnectTime = UpstreamTimePoint{};
a->lastConnectPing = std::chrono::milliseconds{-1};
a->delayCollect->cleanTcpPing();
a->delayCollect->cleanHttpPing();
a->delayCollect->cleanFirstDelay();
}
// recheck
upstreamPool->forceCheckNow();
Expand Down

0 comments on commit 699e2da

Please sign in to comment.