This commit is contained in:
26
test/raven-integration/AutoId.cs
Normal file
26
test/raven-integration/AutoId.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
namespace raven_integration
|
||||
{
|
||||
public class AutoId
|
||||
{
|
||||
private readonly object valueLock = new object();
|
||||
private uint currentValue; //postgre bigint
|
||||
|
||||
public AutoId(uint initialValue)
|
||||
{
|
||||
currentValue = initialValue;
|
||||
}
|
||||
|
||||
public uint GetNext()
|
||||
{
|
||||
lock (valueLock)
|
||||
{
|
||||
currentValue += 1;
|
||||
if (currentValue == 0)
|
||||
currentValue += 1;
|
||||
return currentValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,7 @@ SET /a VAR=0
|
||||
:HOME
|
||||
SET /a VAR=VAR+1
|
||||
rem 1000 runs in local debug mode server is about 6 hours at current test pace with huge data
|
||||
IF %VAR%==100 goto :End
|
||||
|
||||
IF %VAR%==250 goto :End
|
||||
dotnet test
|
||||
|
||||
goto :HOME
|
||||
goto :HOME
|
||||
:End
|
||||
@@ -19,9 +19,12 @@ namespace raven_integration
|
||||
|
||||
public static ConcurrentDictionary<string, string> authDict = new ConcurrentDictionary<string, string>();//10,32
|
||||
|
||||
private static AutoId Auto { get; } = new AutoId(0);
|
||||
|
||||
public static string Uniquify(string s)
|
||||
{
|
||||
return s + " " + ((DateTimeOffset)DateTime.Now).ToUnixTimeMilliseconds().ToString();
|
||||
// return s + " " + Auto.GetNext().ToString();
|
||||
return s + " " + (Auto.GetNext() + ((DateTimeOffset)DateTime.Now).ToUnixTimeMilliseconds()).ToString();
|
||||
}
|
||||
|
||||
public async static Task<string> GetTokenAsync(string login, string password = null)
|
||||
|
||||
Reference in New Issue
Block a user