forked from janhq/cortex.cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess_manager.cc
More file actions
28 lines (27 loc) · 869 Bytes
/
Copy pathprocess_manager.cc
File metadata and controls
28 lines (27 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "process_manager.h"
#include <trantor/utils/Logger.h>
#include <cstdlib>
#include "json/json.h"
#include "utils/cortex_utils.h"
void ProcessManager::destroy(
const HttpRequestPtr& req,
std::function<void(const HttpResponsePtr&)>&& callback) {
(void)req;
auto loaded_engines = engine_service_->GetSupportedEngineNames();
for (const auto& engine : loaded_engines.value()) {
auto result = engine_service_->UnloadEngine(engine);
if (!result) {
// Handle the error if any.
// Log the Error
LOG_ERROR << "Error unloading engine: " << result.error();
continue;
}
}
app().quit();
Json::Value ret;
ret["message"] = "Program is exitting, goodbye!";
auto resp = cortex_utils::CreateCortexHttpJsonResponse(ret);
resp->setStatusCode(k200OK);
callback(resp);
LOG_INFO << "Program is exitting, goodbye!";
};