1
0
mirror of synced 2025-12-09 14:48:14 +08:00

启动时休眠时间调整为可配置项

This commit is contained in:
LiZhengHao
2024-10-16 14:35:26 +08:00
parent e06fc2db93
commit 162dfad61f
2 changed files with 6 additions and 2 deletions

View File

@@ -78,6 +78,10 @@ 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()
{ {

View File

@@ -117,7 +117,7 @@ namespace Yitter.IdGenerator
if (options.Method != 2) if (options.Method != 2)
{ {
Thread.Sleep(500); Thread.Sleep(options.SleepTime);
} }
} }