Increase OE timeout to 60 seconds (#492)

This commit is contained in:
Karl Burtram
2017-10-12 16:56:20 -07:00
committed by GitHub
parent 0ab1dd4c55
commit 14e3b3a3f6
2 changed files with 11 additions and 10 deletions

View File

@@ -44,8 +44,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
private ConcurrentDictionary<string, ObjectExplorerSession> sessionMap;
private readonly Lazy<Dictionary<string, HashSet<ChildFactory>>> applicableNodeChildFactories;
private IMultiServiceProvider serviceProvider;
private ConnectedBindingQueue bindingQueue = new ConnectedBindingQueue(needsMetadata: false);
private const int PrepopulateBindTimeout = 10000;
private ConnectedBindingQueue bindingQueue = new ConnectedBindingQueue(needsMetadata: false);
/// <summary>
@@ -391,13 +390,13 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
{
try
{
int timeout = (int)TimeSpan.FromSeconds(settings?.ExpandTimeout ?? ObjectExplorerSettings.DefaultExpandTimeout).TotalMilliseconds;
QueueItem queueItem = bindingQueue.QueueBindingOperation(
key: bindingQueue.AddConnectionContext(session.ConnectionInfo, "OE"),
bindingTimeout: PrepopulateBindTimeout,
waitForLockTimeout: PrepopulateBindTimeout,
bindingTimeout: timeout,
waitForLockTimeout: timeout,
bindOperation: (bindingContext, cancelToken) =>
{
if (forceRefresh)
{
nodes = node.Refresh().Select(x => x.ToNodeInfo()).ToArray();
@@ -453,10 +452,11 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
return null;
}
int timeout = (int)TimeSpan.FromSeconds(settings?.CreateSessionTimeout ?? ObjectExplorerSettings.DefaultCreateSessionTimeout).TotalMilliseconds;
QueueItem queueItem = bindingQueue.QueueBindingOperation(
key: bindingQueue.AddConnectionContext(connectionInfo),
bindingTimeout: PrepopulateBindTimeout,
waitForLockTimeout: PrepopulateBindTimeout,
bindingTimeout: timeout,
waitForLockTimeout: timeout,
bindOperation: (bindingContext, cancelToken) =>
{
session = ObjectExplorerSession.CreateSession(connectionResult, serviceProvider, bindingContext.ServerConnection);
@@ -465,6 +465,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
sessionMap.AddOrUpdate(uri, session, (key, oldSession) => session);
return session;
});
queueItem.ItemProcessed.WaitOne();
if (queueItem.GetResultAsT<ObjectExplorerSession>() != null)
{
@@ -551,7 +552,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
}
else if (!task.IsCompleted)
{
result.Exception = new TimeoutException($"Object Explorer task didn't completed in {timeoutInSec} seconds.");
result.Exception = new TimeoutException($"Object Explorer task didn't complete within {timeoutInSec} seconds.");
}
return result;
}