-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Run anything service in independent process
Using an independent process to run anything service can solve known log conflict problems. When the service runs abnormally, the service can be restored by creating a new process. Log: handle high CPU usage Task: https://pms.uniontech.com/task-view-300371.html
- Loading branch information
1 parent
82a2295
commit 2d73ea6
Showing
7 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
deepin-anything (6.1.5) unstable; urgency=medium | ||
|
||
* add executable for running anything. | ||
* let process abort when cpu usage limit is exceeded. | ||
|
||
-- Deepin Package Builder <[email protected]> Thu, 26 Oct 2023 14:35:37 +0800 | ||
|
||
deepin-anything (6.1.4) unstable; urgency=medium | ||
|
||
* fix index issue. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
usr/bin/deepin-anything-server | ||
usr/lib/*/libdeepin-anything-server-lib.* | ||
usr/share/dbus-1/interfaces | ||
etc/dbus-1/system.d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ if(NOT CMAKE_BUILD_TYPE) | |
endif(NOT CMAKE_BUILD_TYPE) | ||
|
||
add_subdirectory("backend") | ||
add_subdirectory("app") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
|
||
project(deepin-anything-server) | ||
|
||
# Version | ||
if (NOT PROJECT_VERSION) | ||
set(PROJECT_VERSION "1.0.0") | ||
endif() | ||
|
||
if (NOT PROJECT_VERSION_MAJOR) | ||
set(PROJECT_VERSION_MAJOR 0) | ||
endif() | ||
|
||
include_directories( | ||
${CMAKE_CURRENT_SOURCE_DIR}/../backend | ||
) | ||
|
||
set(SRCS | ||
main.cpp | ||
) | ||
|
||
find_package(PkgConfig REQUIRED) | ||
find_package(Qt5 COMPONENTS Core REQUIRED) | ||
|
||
add_executable(${PROJECT_NAME} ${SRCS}) | ||
|
||
target_link_libraries(${PROJECT_NAME} PUBLIC | ||
Qt5::Core | ||
deepin-anything-server-lib | ||
) | ||
|
||
# binary | ||
install(TARGETS ${PROJECT_NAME} DESTINATION bin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#include <QCoreApplication> | ||
#include <QDebug> | ||
#include "anythingexport.h" | ||
#include <signal.h> | ||
|
||
static void handleSIGTERM(int sig) | ||
{ | ||
qDebug() << "received SIGTERM" << sig; | ||
if (qApp) { | ||
qApp->quit(); | ||
} | ||
} | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
int ret; | ||
|
||
QCoreApplication app(argc, argv); | ||
app.setOrganizationName("deepin"); | ||
|
||
if (fireAnything()) { | ||
qCritical() << "fireAnything failed!"; | ||
abort(); | ||
} | ||
signal(SIGTERM, handleSIGTERM); | ||
|
||
ret = app.exec(); | ||
downAnything(); | ||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters