Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion controllers/llamaCPP.cc
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ bool llamaCPP::loadModelImpl(const Json::Value &jsonBody) {
gpt_params params;

// By default will setting based on number of handlers
int drogon_thread = drogon::app().getThreadNum();
int drogon_thread = drogon::app().getThreadNum() - 1;
LOG_INFO << "Drogon thread is:" << drogon_thread;
if (jsonBody) {
params.model = jsonBody["llama_model_path"].asString();
Expand Down
11 changes: 11 additions & 0 deletions controllers/processManager.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "processManager.h"
#include <cstdlib>
#include <trantor/utils/Logger.h>

void processManager::destroy(const HttpRequestPtr &req,
std::function<void(const HttpResponsePtr &)> &&callback) {
LOG_INFO << "Program is exitting, goodbye!";
exit(0);
return;
};
// Add definition of your processing function here
23 changes: 23 additions & 0 deletions controllers/processManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once

#include <drogon/HttpController.h>
#include <drogon/HttpTypes.h>

using namespace drogon;

class processManager : public drogon::HttpController<processManager> {
public:
METHOD_LIST_BEGIN
// use METHOD_ADD to add your custom processing function here;
// METHOD_ADD(processManager::get, "/{2}/{1}", Get); // path is
// /processManager/{arg2}/{arg1}
METHOD_ADD(processManager::destroy, "/destroy",
Delete); // path is /processManager/{arg1}/{arg2}/list

METHOD_LIST_END
// your declaration of processing function maybe like this:
void destroy(const HttpRequestPtr &req,
std::function<void(const HttpResponsePtr &)> &&callback);
// void your_method_name(const HttpRequestPtr& req, std::function<void (const
// HttpResponsePtr &)> &&callback, double p1, int p2) const;
};
2 changes: 1 addition & 1 deletion llama.cpp
2 changes: 1 addition & 1 deletion main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int main(int argc, char *argv[]) {
LOG_INFO << "Server started, listening at: " << host << ":" << port;
LOG_INFO << "Please load your model";
drogon::app().addListener(host, port);
drogon::app().setThreadNum(thread_num);
drogon::app().setThreadNum(thread_num + 1);
LOG_INFO << "Number of thread is:" << drogon::app().getThreadNum();

drogon::app().run();
Expand Down