Skip to content

Commit 3f4a521

Browse files
committed
modify:time release code
1 parent 5830592 commit 3f4a521

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

XEngine_Source/XEngine_MQServiceApp/MQService_Hdr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ extern XHANDLE xhHttpPool;
7070
extern XHANDLE xhWSPool;
7171

7272
extern XENGINE_SERVERCONFIG st_ServiceCfg;
73+
extern MESSAGEQUEUE_DBCONFIG st_DBConfig;
7374

7475
#include "MQService_Config.h"
7576
#include "MQService_Net.h"

XEngine_Source/XEngine_MQServiceApp/MQService_Task.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,16 @@ void CALLBACK MessageQueue_CBTask_TimePublish(LPCXSTR lpszQueueName, __int64x nI
5151
XEngine_MQXService_Send(tszUserAddr, tszMsgBuffer, nMsgLen, nNetType);
5252
}
5353
BaseLib_OperatorMemory_Free((XPPPMEM)&ppSt_ListUser, nListCount);
54-
//移除这条消息
55-
DBModule_MQUser_TimeDelete(&st_DBTime);
54+
55+
if (st_DBConfig.st_MQUser.st_UserTime.bPubClear)
56+
{
57+
//移除这条消息
58+
DBModule_MQUser_TimeDelete(&st_DBTime);
59+
}
60+
else
61+
{
62+
//更新
63+
DBModule_MQUser_TimeUPDate(&st_DBTime);
64+
}
5665
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("定时任务,消息主题:%s,序列:%lld,定时任务分发成功,客户端个数:%d"), lpszQueueName, nIDMsg, nListCount);
5766
}

XEngine_Source/XEngine_MQServiceApp/XEngine_MQServiceApp.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ XHANDLE xhHttpPool = NULL;
1515
XHANDLE xhWSPool = NULL;
1616

1717
XENGINE_SERVERCONFIG st_ServiceCfg;
18+
MESSAGEQUEUE_DBCONFIG st_DBConfig;
1819

1920
void ServiceApp_Stop(int signo)
2021
{
@@ -88,6 +89,8 @@ int main(int argc, char** argv)
8889
LPCXSTR lpszHTTPMime = _X("./XEngine_Config/HttpMime.types");
8990
LPCXSTR lpszHTTPCode = _X("./XEngine_Config/HttpCode.types");
9091
LPCXSTR lpszLogFile = _X("./XEngine_Log/XEngine_MQServiceApp.Log");
92+
LPCXSTR lpszDBConfig = _X("./XEngine_Config/XEngine_DBConfig.json");
93+
9194
XCHAR tszStringMsg[2048];
9295
HELPCOMPONENTS_XLOG_CONFIGURE st_XLogConfig;
9396
THREADPOOL_PARAMENT** ppSt_ListTCPParam;
@@ -117,9 +120,15 @@ int main(int argc, char** argv)
117120
goto NETSERVICEEXIT;
118121
}
119122
HelpComponents_XLog_SetLogPriority(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO);
120-
121123
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,初始化日志系统成功"));
122124

125+
if (!Config_Json_DBFile(lpszDBConfig, &st_DBConfig))
126+
{
127+
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("启动服务中,初始化数据库配置失败,错误:%lX"), Config_GetLastError());
128+
goto NETSERVICEEXIT;
129+
}
130+
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,初始化数据库配置成功"));
131+
123132
if (st_ServiceCfg.bDeamon)
124133
{
125134
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("初始化守护进程..."));

0 commit comments

Comments
 (0)