mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
Language service no longer binds on duplicate connections (#148)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user