1
0
mirror of synced 2026-02-24 05:47:55 +08:00

TermIndex复位

This commit is contained in:
zhouzj
2021-03-11 16:52:15 +08:00
parent 1d284e6d18
commit 2f7a9fa2fe

View File

@@ -75,7 +75,6 @@ namespace Yitter.IdGenerator
StartTimeUtc = options.StartTime;
}
// 如果没有初始化,则随机一个数值
if (WorkerId < 1)
{
WorkerId = (ushort)DateTime.Now.Millisecond;
@@ -104,11 +103,6 @@ namespace Yitter.IdGenerator
{
Task.Run(() =>
{
if (arg.ActionType == 2 && _TermIndex > 10000)
{
_TermIndex = 0;
}
GenAction(arg);
});
}
@@ -131,6 +125,11 @@ namespace Yitter.IdGenerator
private void EndOverCostCallBack(in long useTimeTick)
{
if (_TermIndex > 10000)
{
_TermIndex = 0;
}
if (GenAction == null)
{
return;