Language service no longer binds on duplicate connections (#148)

This commit is contained in:
Mitchell Sternke
2016-11-15 18:12:16 -08:00
committed by GitHub
parent 5a5f197276
commit 32f6cbc304
2 changed files with 16 additions and 0 deletions

View File

@@ -112,6 +112,17 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
}
}
/// <summary>
/// Checks if a binding context already exists for the provided context key
/// </summary>
protected bool BindingContextExists(string key)
{
lock (this.bindingContextLock)
{
return this.BindingContextMap.ContainsKey(key);
}
}
private bool HasPendingQueueItems
{
get

View File

@@ -61,6 +61,11 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
// lookup the current binding context
string connectionKey = GetConnectionContextKey(connInfo);
if (BindingContextExists(connectionKey))
{
// no need to populate the context again since the context already exists
return connectionKey;
}
IBindingContext bindingContext = this.GetOrCreateBindingContext(connectionKey);
if (bindingContext.BindingLock.WaitOne())