mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 10:58:30 -05:00
Increase OE timeout to 60 seconds (#492)
This commit is contained in:
@@ -44,8 +44,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
|
|||||||
private ConcurrentDictionary<string, ObjectExplorerSession> sessionMap;
|
private ConcurrentDictionary<string, ObjectExplorerSession> sessionMap;
|
||||||
private readonly Lazy<Dictionary<string, HashSet<ChildFactory>>> applicableNodeChildFactories;
|
private readonly Lazy<Dictionary<string, HashSet<ChildFactory>>> applicableNodeChildFactories;
|
||||||
private IMultiServiceProvider serviceProvider;
|
private IMultiServiceProvider serviceProvider;
|
||||||
private ConnectedBindingQueue bindingQueue = new ConnectedBindingQueue(needsMetadata: false);
|
private ConnectedBindingQueue bindingQueue = new ConnectedBindingQueue(needsMetadata: false);
|
||||||
private const int PrepopulateBindTimeout = 10000;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -391,13 +390,13 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
int timeout = (int)TimeSpan.FromSeconds(settings?.ExpandTimeout ?? ObjectExplorerSettings.DefaultExpandTimeout).TotalMilliseconds;
|
||||||
QueueItem queueItem = bindingQueue.QueueBindingOperation(
|
QueueItem queueItem = bindingQueue.QueueBindingOperation(
|
||||||
key: bindingQueue.AddConnectionContext(session.ConnectionInfo, "OE"),
|
key: bindingQueue.AddConnectionContext(session.ConnectionInfo, "OE"),
|
||||||
bindingTimeout: PrepopulateBindTimeout,
|
bindingTimeout: timeout,
|
||||||
waitForLockTimeout: PrepopulateBindTimeout,
|
waitForLockTimeout: timeout,
|
||||||
bindOperation: (bindingContext, cancelToken) =>
|
bindOperation: (bindingContext, cancelToken) =>
|
||||||
{
|
{
|
||||||
|
|
||||||
if (forceRefresh)
|
if (forceRefresh)
|
||||||
{
|
{
|
||||||
nodes = node.Refresh().Select(x => x.ToNodeInfo()).ToArray();
|
nodes = node.Refresh().Select(x => x.ToNodeInfo()).ToArray();
|
||||||
@@ -453,10 +452,11 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int timeout = (int)TimeSpan.FromSeconds(settings?.CreateSessionTimeout ?? ObjectExplorerSettings.DefaultCreateSessionTimeout).TotalMilliseconds;
|
||||||
QueueItem queueItem = bindingQueue.QueueBindingOperation(
|
QueueItem queueItem = bindingQueue.QueueBindingOperation(
|
||||||
key: bindingQueue.AddConnectionContext(connectionInfo),
|
key: bindingQueue.AddConnectionContext(connectionInfo),
|
||||||
bindingTimeout: PrepopulateBindTimeout,
|
bindingTimeout: timeout,
|
||||||
waitForLockTimeout: PrepopulateBindTimeout,
|
waitForLockTimeout: timeout,
|
||||||
bindOperation: (bindingContext, cancelToken) =>
|
bindOperation: (bindingContext, cancelToken) =>
|
||||||
{
|
{
|
||||||
session = ObjectExplorerSession.CreateSession(connectionResult, serviceProvider, bindingContext.ServerConnection);
|
session = ObjectExplorerSession.CreateSession(connectionResult, serviceProvider, bindingContext.ServerConnection);
|
||||||
@@ -465,6 +465,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
|
|||||||
sessionMap.AddOrUpdate(uri, session, (key, oldSession) => session);
|
sessionMap.AddOrUpdate(uri, session, (key, oldSession) => session);
|
||||||
return session;
|
return session;
|
||||||
});
|
});
|
||||||
|
|
||||||
queueItem.ItemProcessed.WaitOne();
|
queueItem.ItemProcessed.WaitOne();
|
||||||
if (queueItem.GetResultAsT<ObjectExplorerSession>() != null)
|
if (queueItem.GetResultAsT<ObjectExplorerSession>() != null)
|
||||||
{
|
{
|
||||||
@@ -551,7 +552,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
|
|||||||
}
|
}
|
||||||
else if (!task.IsCompleted)
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ namespace Microsoft.SqlTools.ServiceLayer.SqlContext
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ObjectExplorerSettings
|
public class ObjectExplorerSettings
|
||||||
{
|
{
|
||||||
public static int DefaultCreateSessionTimeout = 30;
|
public static int DefaultCreateSessionTimeout = 60;
|
||||||
public static int DefaultExpandTimeout = 30;
|
public static int DefaultExpandTimeout = 60;
|
||||||
|
|
||||||
public ObjectExplorerSettings()
|
public ObjectExplorerSettings()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user