Skip to content

Commit

Permalink
Agent.Cocohub 1.0.0.20
Browse files Browse the repository at this point in the history
  • Loading branch information
Yvees committed Apr 26, 2018
1 parent c299315 commit 44142d8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/Agent.Cocohub/Agent.Cocohub.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.0.0.19</Version>
<FileVersion>1.0.0.19</FileVersion>
<AssemblyVersion>1.0.0.19</AssemblyVersion>
<Version>1.0.0.20</Version>
<FileVersion>1.0.0.20</FileVersion>
<AssemblyVersion>1.0.0.20</AssemblyVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
25 changes: 16 additions & 9 deletions src/Agent.Cocohub/AgentThread.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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<LogEntity> entities = new List<LogEntity>();
Expand All @@ -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);
Expand Down

0 comments on commit 44142d8

Please sign in to comment.