提交 8c217d38 authored 作者: blu's avatar blu

improved log messages for subsystems

上级 19e1d622
......@@ -78,7 +78,7 @@ private:
queue<string> *evtQueue;
int streamIdx = -1;
json config;
thread thEdgeMsgHandler, thCloudMsgHandler;
thread thEdgeMsgHandler, thCloudMsgHandler, thHealdChecker;
thread thEvent;
string drport = "5549";
condition_variable cvMsg;
......@@ -1053,6 +1053,28 @@ public:
exit(1);
}
// setup heath checker
thHealdChecker = thread([this]{
int cnt = 0;
uint64_t pktCntLast = pktCnt;
while(true){
if(cnt >=3) {
kill(getpid(), SIGTERM);
exit(1);
}
this_thread::sleep_for(chrono::seconds(30));
if(pktCntLast == pktCnt){
cnt++;
}else{
pktCntLast = pktCnt;
cnt = 0;
}
}
});
if(thHealdChecker.joinable()){
thHealdChecker.detach();
}
ret = zmqhelper::recvConfigMsg(pDaemon, config, addr, selfId);
if(ret != 0) {
spdlog::error("{} failed to receive configration message {}", selfId, addr);
......
......@@ -36,11 +36,12 @@ private:
AVFormatContext *pAVFormatRemux = nullptr;
AVFormatContext *pAVFormatInput = nullptr;
json config;
thread thCloudMsgHandler, thEdgeMsgHandler;
thread thCloudMsgHandler, thEdgeMsgHandler, thHealdChecker;
string drport = "5549";
condition_variable cvMsg;
mutex mutMsg;
bool gotFormat = false;
uint64_t pktCnt = 0;
int init()
{
......@@ -488,7 +489,6 @@ protected:
int ret = 0;
zmq_msg_t msg;
AVPacket packet;
uint64_t pktCnt = 0;
bool bStatsSent = false;
while (true) {
ret =zmq_msg_init(&msg);
......@@ -636,6 +636,28 @@ public:
exit(1);
}
// setup heath checker
thHealdChecker = thread([this]{
int cnt = 0;
uint64_t pktCntLast = pktCnt;
while(true){
if(cnt >=3) {
kill(getpid(), SIGTERM);
exit(1);
}
this_thread::sleep_for(chrono::seconds(30));
if(pktCntLast == pktCnt){
cnt++;
}else{
pktCntLast = pktCnt;
cnt = 0;
}
}
});
if(thHealdChecker.joinable()){
thHealdChecker.detach();
}
ret = zmqhelper::recvConfigMsg(pDaemon, config, addr, selfId);
if(ret != 0) {
spdlog::error("{} failed to receive configration message {}", selfId, addr);
......
......@@ -50,7 +50,7 @@ private:
AVDictionary *pOptsRemux = nullptr;
int *streamList = nullptr;
json config;
thread thEdgeMsgHandler, thCloudMsgHandler, thSliceMgr;
thread thEdgeMsgHandler, thCloudMsgHandler, thSliceMgr, thHealdChecker;
string drport = "5549";
json slices;
condition_variable cvMsg;
......@@ -63,6 +63,7 @@ private:
string videoFileServerApi = "http://139.219.142.18:10008/upload/evtvideos/";
set<long> sTsList;
mutex mutTsList;
uint64_t pktCnt = 0;
bool validMsg(json &msg)
......@@ -514,7 +515,6 @@ protected:
void run()
{
int ret = 0;
int pktCnt = 0;
AVStream * out_stream = nullptr;
zmq_msg_t msg;
AVPacket packet;
......@@ -954,6 +954,30 @@ public:
exit(1);
}
// health checker
// setup heath checker
thHealdChecker = thread([this]{
int cnt = 0;
uint64_t pktCntLast = pktCnt;
while(true){
if(cnt >=3) {
kill(getpid(), SIGTERM);
exit(1);
}
this_thread::sleep_for(chrono::seconds(30));
if(pktCntLast == pktCnt){
cnt++;
}else{
pktCntLast = pktCnt;
cnt = 0;
}
}
});
if(thHealdChecker.joinable()){
thHealdChecker.detach();
}
ret = zmqhelper::recvConfigMsg(pDaemon, config, addr, selfId);
if(ret != 0) {
spdlog::error("{} failed to receive configration message {}", selfId, addr);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论