mirror of
https://github.com/typesense/typesense.git
synced 2025-05-16 11:28:44 +08:00
fix: Do housekeeping for authmanager at regular intervals
This commit is contained in:
parent
dffcdda35f
commit
e02a9a69b9
@ -10,6 +10,7 @@ private:
|
||||
|
||||
std::atomic<bool> quit = false;
|
||||
std::atomic<uint32_t> hnsw_repair_interval_s = 1800;
|
||||
std::atomic<uint32_t> remove_expired_keys_interval_s = 3600;
|
||||
|
||||
HouseKeeper() {}
|
||||
|
||||
|
@ -5,6 +5,9 @@ void HouseKeeper::run() {
|
||||
uint64_t prev_hnsw_repair_s = std::chrono::duration_cast<std::chrono::seconds>(
|
||||
std::chrono::system_clock::now().time_since_epoch()).count();
|
||||
|
||||
uint64_t prev_remove_expired_keys_s = std::chrono::duration_cast<std::chrono::seconds>(
|
||||
std::chrono::system_clock::now().time_since_epoch()).count();
|
||||
|
||||
uint64_t prev_db_compaction_s = std::chrono::duration_cast<std::chrono::seconds>(
|
||||
std::chrono::system_clock::now().time_since_epoch()).count();
|
||||
|
||||
@ -48,13 +51,18 @@ void HouseKeeper::run() {
|
||||
LOG(INFO) << "Ran housekeeping for " << coll_names.size() << " collections.";
|
||||
}
|
||||
|
||||
//do housekeeping for authmanager
|
||||
CollectionManager::get_instance().getAuthManager().do_housekeeping();
|
||||
|
||||
prev_hnsw_repair_s = std::chrono::duration_cast<std::chrono::seconds>(
|
||||
std::chrono::system_clock::now().time_since_epoch()).count();
|
||||
}*/
|
||||
|
||||
if (now_ts_seconds - prev_remove_expired_keys_s >= remove_expired_keys_interval_s) {
|
||||
// Do housekeeping for authmanager
|
||||
CollectionManager::get_instance().getAuthManager().do_housekeeping();
|
||||
|
||||
prev_remove_expired_keys_s = std::chrono::duration_cast<std::chrono::seconds>(
|
||||
std::chrono::system_clock::now().time_since_epoch()).count();
|
||||
}
|
||||
|
||||
lk.unlock();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user