diff --git a/misc/conf_examples/Edge.xml b/misc/conf_examples/Edge.xml index 6d03726ca..5d9239487 100644 --- a/misc/conf_examples/Edge.xml +++ b/misc/conf_examples/Edge.xml @@ -22,11 +22,12 @@ true - true - + + false + diff --git a/src/projects/config/items/modules/dynamic_app_removal.h b/src/projects/config/items/modules/dynamic_app_removal.h new file mode 100644 index 000000000..9ab1e3331 --- /dev/null +++ b/src/projects/config/items/modules/dynamic_app_removal.h @@ -0,0 +1,31 @@ +//============================================================================== +// +// OvenMediaEngine +// +// Created by Getroot +// Copyright (c) 2024 AirenSoft. All rights reserved. +// +//============================================================================== +#pragma once + +#include "module_template.h" + +namespace cfg +{ + namespace modules + { + struct DynamicAppRemoval : public ModuleTemplate + { + protected: + + public: + + protected: + void MakeList() override + { + SetEnable(false); + ModuleTemplate::MakeList(); + } + }; + } // namespace modules +} // namespace cfg \ No newline at end of file diff --git a/src/projects/config/items/modules/modules.h b/src/projects/config/items/modules/modules.h index fe99384d1..c0e652980 100644 --- a/src/projects/config/items/modules/modules.h +++ b/src/projects/config/items/modules/modules.h @@ -12,6 +12,7 @@ #include "ll_hls.h" #include "p2p.h" #include "recovery.h" +#include "dynamic_app_removal.h" namespace cfg { @@ -24,12 +25,14 @@ namespace cfg LLHls _ll_hls; P2P _p2p; Recovery _recovery; + DynamicAppRemoval _dynamic_app_removal; public: CFG_DECLARE_CONST_REF_GETTER_OF(GetHttp2, _http2) CFG_DECLARE_CONST_REF_GETTER_OF(GetLLHls, _ll_hls) CFG_DECLARE_CONST_REF_GETTER_OF(GetP2P, _p2p) CFG_DECLARE_CONST_REF_GETTER_OF(GetRecovery, _recovery) + CFG_DECLARE_CONST_REF_GETTER_OF(GetDynamicAppRemoval, _dynamic_app_removal) protected: void MakeList() override @@ -38,6 +41,7 @@ namespace cfg Register("LLHLS", &_ll_hls); Register({"P2P", "p2p"}, &_p2p); Register("Recovery", &_recovery); + Register("DynamicAppRemoval", &_dynamic_app_removal); } }; } // namespace modules diff --git a/src/projects/orchestrator/orchestrator.cpp b/src/projects/orchestrator/orchestrator.cpp index 5daa8341f..b50b66322 100644 --- a/src/projects/orchestrator/orchestrator.cpp +++ b/src/projects/orchestrator/orchestrator.cpp @@ -33,14 +33,18 @@ namespace ocst return false; } - // TODO(Getroot): 2024-10-07 // It has critical bug. It should be fixed. - // _timer.Push( - // [this](void *paramter) -> ov::DelayQueueAction { - // DeleteUnusedDynamicApplications(); - // return ov::DelayQueueAction::Repeat; - // }, - // 10000); - // _timer.Start(); + auto dynamic_app_removal = server_config->GetModules().GetDynamicAppRemoval(); + if (dynamic_app_removal.IsEnabled() == true) + { + // TODO(Getroot): 2024-10-07 // It may have critical bug. It should be fixed. + _timer.Push( + [this](void *paramter) -> ov::DelayQueueAction { + DeleteUnusedDynamicApplications(); + return ov::DelayQueueAction::Repeat; + }, + 10000); + _timer.Start(); + } return true; }