From 948e83221cec1e39e662b7937cfdf7dfcc85f984 Mon Sep 17 00:00:00 2001 From: "Nikolay.Pianikov" Date: Wed, 31 May 2017 17:56:41 +0300 Subject: [PATCH] #21 Sometimes flow ids are clashed --- .../Write/Special/Impl/DefaultFlowIdGenerator.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/TeamCity.ServiceMessages/Write/Special/Impl/DefaultFlowIdGenerator.cs b/TeamCity.ServiceMessages/Write/Special/Impl/DefaultFlowIdGenerator.cs index 34815af..274c619 100644 --- a/TeamCity.ServiceMessages/Write/Special/Impl/DefaultFlowIdGenerator.cs +++ b/TeamCity.ServiceMessages/Write/Special/Impl/DefaultFlowIdGenerator.cs @@ -16,7 +16,6 @@ namespace JetBrains.TeamCity.ServiceMessages.Write.Special.Impl { - using System; using System.Globalization; using System.Threading; @@ -25,22 +24,14 @@ namespace JetBrains.TeamCity.ServiceMessages.Write.Special.Impl /// public class DefaultFlowIdGenerator : IFlowIdGenerator { - private int _ids; + private static long ourIds; /// /// Generates new unique FlowId /// public string NewFlowId() { - return ( -#if !NET35 && !NET40 - Interlocked.Increment(ref _ids) -#else - Interlocked.Increment(ref _ids) << (27 - + (Thread.CurrentThread.ManagedThreadId << 21) - + Environment.TickCount % int.MaxValue) -#endif - ).ToString(CultureInfo.InvariantCulture); + return Interlocked.Increment(ref ourIds).ToString(CultureInfo.InvariantCulture); } } } \ No newline at end of file