mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-15 14:04:44 +08:00
Snowflake ID time rollback process
This commit is contained in:
parent
c3f6f18e3e
commit
a089ba7ed0
@ -81,10 +81,14 @@ namespace SqlSugar.DistributedSystem.Snowflake
|
||||
|
||||
if (timestamp < _lastTimestamp)
|
||||
{
|
||||
if (StaticConfig.CustomSnowFlakeTimeErrorFunc != null)
|
||||
{
|
||||
return StaticConfig.CustomSnowFlakeTimeErrorFunc();
|
||||
}
|
||||
//exceptionCounter.incr(1);
|
||||
//log.Error("clock is moving backwards. Rejecting requests until %d.", _lastTimestamp);
|
||||
throw new InvalidSystemClock(String.Format(
|
||||
"Clock moved backwards. Refusing to generate id for {0} milliseconds", _lastTimestamp - timestamp));
|
||||
"服务器时间出现回退你可以使用StaticConfig.CustomSnowFlakeTimeErrorFunc=【自定义方法】处理让他不报错返回新ID,Clock moved backwards. Refusing to generate id for {0} milliseconds", _lastTimestamp - timestamp));
|
||||
}
|
||||
|
||||
if (_lastTimestamp == timestamp)
|
||||
|
@ -13,6 +13,7 @@ namespace SqlSugar
|
||||
|
||||
public const string CodeFirst_BigString = "varcharmax,longtext,text,clob";
|
||||
public static Func<long> CustomSnowFlakeFunc;
|
||||
public static Func<long> CustomSnowFlakeTimeErrorFunc;
|
||||
|
||||
public static Action<object> CompleteQueryableFunc;
|
||||
public static Action<object> CompleteInsertableFunc;
|
||||
|
Loading…
Reference in New Issue
Block a user