| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Core.Const; |
| | | using WIDESEAWCS_Core.DB; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_Core.HttpContextUser; |
| | |
| | | /// 2. 当缓存表有数据时,使用SqlSugar进行批量插入 |
| | | /// 3. 发生异常时会输出错误信息但不会终止线程 |
| | | /// </remarks> |
| | | static void StartWriteLog() |
| | | static async void StartWriteLog() |
| | | { |
| | | DataTable queueTable = CreateEmptyTable(); |
| | | while (true) |
| | |
| | | DequeueToTable(queueTable); continue; |
| | | } |
| | | //每5秒写一次数据 |
| | | Thread.Sleep(5000); |
| | | await Task.Delay(CommunicationConst.LogWriteIntervalMs); |
| | | |
| | | //如果队列表中的行数为0,则跳过本次循环 |
| | | if (queueTable.Rows.Count == 0) { continue; } |