N
null_X
Guest
I'm downloading files with this code:
TfsTeamProjectCollection tfsTeamProjectCollection
= new TfsTeamProjectCollection(new Uri("http://local.DevOps-TFS/tfs/resourceCollection"));
Workspace ws
= Workstation.Current.GetAllLocalWorkspaceInfo()[0].GetWorkspace(tfsTeamProjectCollection);
Stopwatch s = new Stopwatch();
s.Start();
ws.Get(new string[] { "$/REPO/file.cpp" }, VersionSpec.Latest, RecursionType.OneLevel, GetOptions.GetAll);
s.Stop();
Console.WriteLine(s.Elapsed.TotalSeconds);
Stopwatch s = new Stopwatch();
s.Start();
ws.Get(new string[] { "$/REPO/file2.cpp" }, VersionSpec.Latest, RecursionType.OneLevel, GetOptions.GetAll);
s.Stop();
Console.WriteLine(s.Elapsed.TotalSeconds);
This works well, except that the first GET takes 9 seconds, the 2nd get takes 0.05 seconds. It doesn't matter what files and how many I'm getting, the first file ALWAYS takes significantly longer than the following gets.
The weird thing is: getting the file with the TF.exe works way faster, the first get is as fast as the other ones.
tf vc get $/REPO/file.cpp /force
I've debugged into the TFS-API Source-code and the problem is the moment the API waits for the rest-api call to finish. I assume that there's a problem with the authentication, but I couldn't figure out what exactly is wrong. I've also debugged into the TF.exe to see how they authenticate, but I didn't find anything specific and they're using the same code as above. But somehow the rest-api call started from the TF.exe finished much faster than the rest-api call from my application.
We're using TFS version 16. Any suggestions on how to continue?
Continue reading...
TfsTeamProjectCollection tfsTeamProjectCollection
= new TfsTeamProjectCollection(new Uri("http://local.DevOps-TFS/tfs/resourceCollection"));
Workspace ws
= Workstation.Current.GetAllLocalWorkspaceInfo()[0].GetWorkspace(tfsTeamProjectCollection);
Stopwatch s = new Stopwatch();
s.Start();
ws.Get(new string[] { "$/REPO/file.cpp" }, VersionSpec.Latest, RecursionType.OneLevel, GetOptions.GetAll);
s.Stop();
Console.WriteLine(s.Elapsed.TotalSeconds);
Stopwatch s = new Stopwatch();
s.Start();
ws.Get(new string[] { "$/REPO/file2.cpp" }, VersionSpec.Latest, RecursionType.OneLevel, GetOptions.GetAll);
s.Stop();
Console.WriteLine(s.Elapsed.TotalSeconds);
This works well, except that the first GET takes 9 seconds, the 2nd get takes 0.05 seconds. It doesn't matter what files and how many I'm getting, the first file ALWAYS takes significantly longer than the following gets.
The weird thing is: getting the file with the TF.exe works way faster, the first get is as fast as the other ones.
tf vc get $/REPO/file.cpp /force
I've debugged into the TFS-API Source-code and the problem is the moment the API waits for the rest-api call to finish. I assume that there's a problem with the authentication, but I couldn't figure out what exactly is wrong. I've also debugged into the TF.exe to see how they authenticate, but I didn't find anything specific and they're using the same code as above. But somehow the rest-api call started from the TF.exe finished much faster than the rest-api call from my application.
We're using TFS version 16. Any suggestions on how to continue?
Continue reading...