MCPcopy Create free account
hub / github.com/Tencent/Tendis / cron

Method cron

src/tendisplus/script/script_manager.cpp:203–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201}
202
203void ScriptManager::cron() {
204 std::unique_lock<std::shared_timed_mutex> lock(_mutex);
205 uint64_t cur = msSinceEpoch();
206 static uint64_t maxIdelTime = _svr->getParams()->luaStateMaxIdleTime;
207 for (auto iter = _mapLuaState.begin(); iter != _mapLuaState.end();) {
208 if (!iter->second->isRunning() &&
209 cur - iter->second->lastEndTime() > maxIdelTime) {
210 LOG(INFO) << "delete LuaState, threadid:" << iter->first
211 << " idletime:" << cur - iter->second->lastEndTime()
212 << " running size:" << _mapLuaState.size();
213 iter = _mapLuaState.erase(iter);
214 } else {
215 iter++;
216 }
217 }
218}
219
220Status ScriptManager::stopStore(uint32_t storeId) {
221 return {ErrorCodes::ERR_OK, ""};

Callers 1

serverCronMethod · 0.80

Calls 4

msSinceEpochFunction · 0.85
lastEndTimeMethod · 0.80
sizeMethod · 0.80
isRunningMethod · 0.45

Tested by

no test coverage detected