启动时休眠时间调整为可配置项
This commit is contained in:
@@ -78,7 +78,11 @@ namespace Yitter.IdGenerator
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual byte TimestampType { get; set; } = 0;
|
public virtual byte TimestampType { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 在使用漂移算法时启动的休眠时间,默认500毫秒
|
||||||
|
/// </summary>
|
||||||
|
public virtual TimeSpan SleepTime { get; set; }=TimeSpan.FromMilliseconds(500);
|
||||||
|
|
||||||
public IdGeneratorOptions()
|
public IdGeneratorOptions()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace Yitter.IdGenerator
|
|||||||
|
|
||||||
if (options.Method != 2)
|
if (options.Method != 2)
|
||||||
{
|
{
|
||||||
Thread.Sleep(500);
|
Thread.Sleep(options.SleepTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user