Browse Source

Merge branch 'dev-zyj' of usky-cloud-paas/data-writer into master

James 1 year ago
parent
commit
7ae681304e

+ 2 - 1
DataWriteDog/dogcore.cpp

@@ -60,8 +60,9 @@ void DogCore::time_out()
             }
         }
         if((dataWriteShm->processStatus[1].t_time>0)
-                &&(static_cast<int>(chkTime1-dataWriteShm->processStatus[1].t_time)>60)){
+                &&(static_cast<int>(chkTime1-dataWriteShm->processStatus[1].t_time)>120)){
             if(system("killall ytDataWriteProcess")!=-1){
+                sleep(1);
                 if(system("/root/bin/ytDataWriteProcess &")!=-1){
                     logThread->appendData(QString("[%1 dataWriteDog %2] ytDataWriteProcess time out: %3")
                                           .arg(QDateTime::fromTime_t(chkTime1).toString("yyyy-MM-dd HH:mm:ss"))

+ 1 - 1
ytDataWriteProcess/databasethread.cpp

@@ -74,7 +74,7 @@ void DatabaseThread::run()
                 while (sqlList.length()>0) {
                     db.exec(sqlList.first());
 
-                    emit dbdata_log(QString("[%1] writeProcess sql %2").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss.zzz")).arg(sqlList.first()));
+                    emit dbdata_log(QString("[%1] sqlList.length() %2 writeProcess sql %3").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss.zzz")).arg(sqlList.length()).arg(sqlList.first()));
 
                     sqlList.removeFirst();
                     usleep(1000);

+ 1 - 1
ytDataWriteProcess/dealmqttthread.cpp

@@ -31,7 +31,7 @@ void DealMqttThread::run()
 
                 QJsonParseError parseErr;
                 QJsonDocument doc = QJsonDocument::fromJson(data,&parseErr);
-                printf("data write arseErr.error %d\n",parseErr.error);
+                printf("mqttDataList.length() %d,  data write arseErr.error %d\n",mqttDataList.length(),parseErr.error);
                 if(parseErr.error==QJsonParseError::NoError){
                     QJsonObject obj = doc.object();
                     QString deviceId = obj.value("device_id").toString();

+ 2 - 0
ytDataWriteProcess/mqttdatathread.cpp

@@ -1,4 +1,5 @@
 #include "mqttdatathread.h"
+#include "../DataWriteDog/writeshm.h"
 
 MqttDataThread::MqttDataThread(QObject *parent) : QThread(parent)
 {
@@ -14,6 +15,7 @@ void MqttDataThread::run()
 
 void MqttDataThread::time_out()
 {
+    dataWriteShm->processStatus[1].t_time = QDateTime::currentDateTime().toTime_t();
     if((m_client->connectionState()==QMQTT::STATE_DISCONNECTED)||(m_client->connectionState()==QMQTT::STATE_INIT)){
         m_client->connectToHost();
     }