MCPcopy Create free account
hub / github.com/Icinga/icinga2 / ScriptFrameCleanupHandler

Function ScriptFrameCleanupHandler

lib/remote/consolehandler.cpp:27–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25static std::mutex l_ApiScriptMutex;
26
27static void ScriptFrameCleanupHandler()
28{
29 std::unique_lock<std::mutex> lock(l_ApiScriptMutex);
30
31 std::vector<String> cleanup_keys;
32
33 for (auto& kv : l_ApiScriptFrames) {
34 std::unique_lock frameLock(kv.second->Mutex, std::try_to_lock);
35 if (!frameLock) {
36 // If the frame is locked, it's in use, don't expire it this time.
37 continue;
38 }
39
40 if (kv.second->Seen < Utility::GetTime() - 1800)
41 cleanup_keys.push_back(kv.first);
42 }
43
44 for (const String& key : cleanup_keys)
45 l_ApiScriptFrames.erase(key);
46}
47
48static void EnsureFrameCleanupTimer()
49{

Callers 1

EnsureFrameCleanupTimerFunction · 0.85

Calls 2

push_backMethod · 0.80
eraseMethod · 0.45

Tested by

no test coverage detected