diff --git a/src/Agent.Cocohub/Agent.Cocohub.csproj b/src/Agent.Cocohub/Agent.Cocohub.csproj index 7403693..f51195e 100644 --- a/src/Agent.Cocohub/Agent.Cocohub.csproj +++ b/src/Agent.Cocohub/Agent.Cocohub.csproj @@ -3,9 +3,9 @@ netstandard2.0 true - 1.0.0.19 - 1.0.0.19 - 1.0.0.19 + 1.0.0.20 + 1.0.0.20 + 1.0.0.20 diff --git a/src/Agent.Cocohub/AgentThread.cs b/src/Agent.Cocohub/AgentThread.cs index eed7dbb..3894028 100644 --- a/src/Agent.Cocohub/AgentThread.cs +++ b/src/Agent.Cocohub/AgentThread.cs @@ -41,19 +41,22 @@ internal static void CoreFetch() { try { + if (_logs.Count > 1000) + { + Thread.Sleep(1000); + continue; + } + var logs = LogReader.Fetch(); if (logs == null || logs.Length == 0) { - Thread.Sleep(3000); + Thread.Sleep(1000); continue; } Parallel.ForEach(logs, (log) => { _logs.Enqueue(log); }); - if (logs.Length >= 5000) - Thread.Sleep(1000); - else - Thread.Sleep(10000); + Thread.Sleep(1000); } catch(Exception ex) { @@ -72,10 +75,10 @@ internal static void CoreWrite() { try { - int loop = _logs.Count > 10000 ? 10000 : _logs.Count; + int loop = _logs.Count > 5000 ? 5000 : _logs.Count; if (loop == 0) { - Thread.Sleep(3000); + Thread.Sleep(1000); continue; } List entities = new List(); @@ -100,11 +103,15 @@ internal static void CoreWrite() _error.Clear(); _error = null; } - + if (entities.Count > 0) + { _write(entities); + entities.Clear(); + entities = null; + } - if (loop >= 10000) + if (loop >= 5000) Thread.Sleep(1000); else Thread.Sleep(3000);