Skip to content

Commit

Permalink
减轻线程池负担
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Jun 25, 2018
1 parent 8a02c2d commit 5b68b18
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion NewLife.Core/Agent/AgentServiceBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public abstract class AgentServiceBase<TService> : AgentServiceBase, IAgentServi
#region 构造
static AgentServiceBase()
{
XTrace.UseConsole();

if (_Instance == null) _Instance = new TService();
}

Expand Down Expand Up @@ -126,7 +128,6 @@ public static void ServiceMain()
Console.Title = service.DisplayName;

#region 命令行
XTrace.UseConsole();
service.Log = XTrace.Log;

// 输出状态
Expand Down
2 changes: 1 addition & 1 deletion NewLife.Core/Log/PerfCounter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void Increment(Int64 value, Int64 usCost)
{
lock (this)
{
if (_Timer == null) _Timer = new TimerX(DoWork, null, Interval, Interval) { Async = true };
if (_Timer == null) _Timer = new TimerX(DoWork, null, Interval, Interval);
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion XCode/Entity/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,8 @@ public static Int64 FindCount(Expression where, String order = null, String sele
///// <returns>总行数</returns>
//public static Int32 FindCount(String sql)
//{
// if (!sql.ToLower().Contains("select")) // return FindCount(sql, null, null, 0, 0);
// if (!sql.ToLower().Contains("select"))
// return FindCount(sql, null, null, 0, 0);

// var session = Meta.Session;

Expand Down
1 change: 1 addition & 0 deletions XCode/Entity/EntityQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public EntityQueue(IEntitySession session)
{
Session = session;
_Timer = new TimerX(Work, null, Period, Period, "EQ") { Async = true };
_Timer.CanExecute = () => DelayEntities.Any() || Entities.Any();
}
#endregion

Expand Down

0 comments on commit 5b68b18

Please sign in to comment.