xxl-job的dotnet core 执行器实现
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

39 lines
869 B

using System;
namespace DotXxlJob.Core.Model
{
public class AddressEntry
{
public string RequestUri { get; set; }
private DateTime? LastFailedTime { get; set; }
private int FailedTimes { get; set; }
public bool CheckAccessible()
{
if (LastFailedTime == null)
return true;
if (DateTime.UtcNow.Subtract(LastFailedTime.Value) > Constants.AdminServerReconnectInterval)
return true;
if (FailedTimes < Constants.AdminServerCircuitFailedTimes)
return true;
return false;
}
public void Reset()
{
LastFailedTime = null;
FailedTimes = 0;
}
public void SetFail()
{
LastFailedTime = DateTime.UtcNow;
FailedTimes++;
}
}
}