| 2094 | } |
| 2095 | |
| 2096 | void 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 | |
| 2119 | int HTTPServer::getAuth(http::Context& ctx, AuthContext& auth, const std::string& dbName) const { |
| 2120 | const std::string_view authHeader = ctx.request->headers.Get("authorization"); |
nothing calls this directly
no test coverage detected