MCPcopy Create free account
hub / github.com/Restream/reindexer / removeExpiredTx

Method removeExpiredTx

cpp_src/server/httpserver.cc:2096–2117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2094}
2095
2096void HTTPServer::removeExpiredTx() {
2097 const auto now = TxDeadlineClock::now_coarse();
2098
2099 lock_guard lck(txMtx_);
2100 for (auto it = txMap_.begin(); it != txMap_.end();) {
2101 if (it->second.txDeadline <= now) {
2102 auto ctx = MakeSystemAuthContext();
2103 auto err = dbMgr_.OpenDatabase(it->second.dbName, ctx, false);
2104 if (err.ok()) {
2105 reindexer::Reindexer* db = nullptr;
2106 err = ctx.GetDB<AuthContext::CalledFrom::HTTPServer>(kRoleSystem, &db);
2107 if (db && err.ok()) {
2108 logger_.info("Rollback tx {} on idle deadline", it->first);
2109 err = db->RollBackTransaction(*it->second.tx);
2110 }
2111 }
2112 it = txMap_.erase(it);
2113 } else {
2114 ++it;
2115 }
2116 }
2117}
2118
2119int HTTPServer::getAuth(http::Context& ctx, AuthContext& auth, const std::string& dbName) const {
2120 const std::string_view authHeader = ctx.request->headers.Get("authorization");

Callers

nothing calls this directly

Calls 8

MakeSystemAuthContextFunction · 0.85
okMethod · 0.80
infoMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
OpenDatabaseMethod · 0.45
RollBackTransactionMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected