protected override void OnTick() { long curTime = TimeUtility.GetLocalMilliseconds(); if (m_LastTickTime + c_TickInterval < curTime) { m_LastTickTime = curTime; DBConn.KeepConnection(); try { MySqlConnection conn = DBConn.MySqlConn; using (MySqlCommand cmd = new MySqlCommand("select * from GowStar where 1=2", conn)) { cmd.ExecuteNonQuery(); } } catch (Exception ex) { LogSys.Log(LOG_TYPE.INFO, "DbThread.Tick keep connection exception:{0}\n{1}", ex.Message, ex.StackTrace); } } }
protected override void OnTick() { long curTime = TimeUtility.GetLocalMilliseconds(); if (m_LastElapsedTickTime != 0) { long elapsedTickTime = curTime - m_LastElapsedTickTime; if (elapsedTickTime > c_WarningTickTime) { LogSys.Log(LOG_TYPE.MONITOR, "DbThread Tick:{0} {1}", this.Thread.ManagedThreadId, elapsedTickTime); } } m_LastElapsedTickTime = curTime; if (DataCacheConfig.IsPersistent) { if (m_LastTickTime + c_TickInterval < curTime) { m_LastTickTime = curTime; DBConn.KeepConnection(); try { MySqlConnection conn = DBConn.MySqlConn; using (MySqlCommand cmd = new MySqlCommand("select * from DSNodeInfo where 1=2", conn)) { cmd.ExecuteNonQuery(); } } catch (Exception ex) { LogSys.Log(LOG_TYPE.ERROR, "DbThread.Tick keep connection exception:{0}\n{1}", ex.Message, ex.StackTrace); } } } if (m_LastLogTime + 60000 < curTime) { m_LastLogTime = curTime; DebugPoolCount((string msg) => { LogSys.Log(LOG_TYPE.INFO, "DbThread.ActionQueue {0} {1}", this.Thread.ManagedThreadId, msg); }); LogSys.Log(LOG_TYPE.MONITOR, "DbThread.ActionQueue Current Action {0} {1}", this.Thread.ManagedThreadId, this.CurActionNum); } }