Prechádzať zdrojové kódy

Z991239-5255 #comment 实体lost的处理修改:启动阶段不管,超限不管

oilyang 1 rok pred
rodič
commit
0f2ba4cbf8

+ 22 - 6
Module/mod_healthmanager/mod_healthmanager.cpp

@@ -944,7 +944,16 @@ bool CHealthManagerEntity::DoRestart()
 		}
 	} while (false);
 
-	DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("DoRestart")("m_maxRestartTimes(%d)",m_maxRestartTimes);
+	do {
+		m_maxLostTimes = 10;
+		int value(0);
+		spConfig->ReadConfigValueInt(GetEntityName(), "MaxLostTimes", value);
+		if (value > 0) {
+			m_maxLostTimes = value;
+		}
+	} while (false);
+
+	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("m_maxRestartTimes:%d, MaxLostTimes:%d", m_maxRestartTimes, m_maxLostTimes);
 
 	defaultTimesMax = 10;
 	do {
@@ -1936,12 +1945,20 @@ void CHealthManagerEntity::OnEntityStateHook(const char* pszEntityName, const ch
 				csResultCode = CSimpleStringA::Format("RTA51%c%c", iByteHigh + 0x30, iByteLow - 10 + 0x41);
 			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("resultcode:%s", csResultCode.GetData());
 			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setLogCode("QLR0402501Z001").setResultCode(csResultCode.GetData())(tmpWarnMsg.GetData());
-			
-			//doing nothing. HandShake will take it.
-			//EntityLostProcTask* task = new EntityLostProcTask(this,pszEntityName); 
-			//GetFunction()->PostThreadPoolTask(task);
+			m_modRunInfo[pszEntityName].lostCount++;
+			//doing nothing before enter main page. HandShake will take it.
+			if (!m_bEnterMainPageEver && m_modRunInfo[pszEntityName].lostCount < m_maxLostTimes)
+			{
+				EntityLostProcTask* task = new EntityLostProcTask(this, pszEntityName);
+				GetFunction()->PostThreadPoolTask(task);
+			}
 		}
 		break;
+		case EntityState_Idle:
+		{
+			if (_strnicmp("Chromium", pszEntityName, strlen("Chromium")) == 0)
+				LogEvent(Severity_Middle, LOG_EVT_SELFCHECK_IEBROWSER_IDLE, "Chromium to idle.");
+		}
 		default:
 			break;
 		}
@@ -2054,7 +2071,6 @@ ErrorCodeEnum CHealthManagerEntity::CheckEntity(const char* pszEntityName, Entit
 		//oilyang@20230426 ,常规自检时,针对"TerminalStage"做对应处理(自检分常规自检和即时自检)
 		//"S":准入服务告知准入不过,不再进行实体自检
 		//非"A":其他启动失败导致进关门页,不再对硬件以及其他没必要自检的实体进行自检
-		//oiltmp@20240321 TODO? need to check key entity while in close page?
 		CSimpleStringA tmpTerminalStage("");
 		GetFunction()->GetSysVar("TerminalStage", tmpTerminalStage);
 		if (tmpTerminalStage.Compare("S") == 0)

+ 4 - 1
Module/mod_healthmanager/mod_healthmanager.h

@@ -51,6 +51,7 @@ struct ModuleRunInfo
 {
 	DWORD dwStart;
 	int count;
+	int lostCount;
 };
 struct RestartModeInfo
 {
@@ -199,6 +200,8 @@ public:
 				{
 					m_activeEntity.Init(100);
 					m_activeEntity = ctx->Req.entityList.Split('|');
+					for (int i = 0; i < m_activeEntity.GetCount(); ++i)
+						m_modRunInfo[m_activeEntity[i]].lostCount = 0;
 				}
 			}
 			else
@@ -266,7 +269,7 @@ private:
 		, m_uuidRemoteController, m_uuidGUIConsole, m_uuidHeartBeat, m_uuidIE, m_uuidCenterS, m_uuidVtmLoader;
 	CUUID m_uuidPublic, m_uuid4SIPPhone;
 	int m_devCfgNum,m_connectStatus;
-	int m_restartHour, m_restartMinute, m_lastHour, m_restartTimes, m_maxRestartTimes, m_preDay, m_dayNum, m_maxRunDays, m_guardianCount;
+	int m_restartHour, m_restartMinute, m_lastHour, m_restartTimes, m_maxRestartTimes, m_preDay, m_dayNum, m_maxRunDays, m_guardianCount, m_maxLostTimes;
 	bool m_bInit, m_bWaitRestartPC, m_bScreenLock, m_bToRestart, m_testFlag, m_bSayIdle
 		, m_bGuardianRun, m_bVerRollback, m_bBrowserIdleFirst, m_bNeedToRestartPAD
 		, m_bInMainPage, m_bEnterMainPageEver, m_bHaveThrowMainPage, m_bToRestartByCenterSetting;