mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-17 02:51:45 -05:00
Changing polling on startup to avoid profiler freezing (#620)
This commit is contained in:
committed by
GitHub
parent
34275c6a6d
commit
c87b369426
@@ -126,7 +126,8 @@ namespace Microsoft.SqlTools.ServiceLayer.Profiler
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Filter the event list to not include previously seen events
|
/// Filter the event list to not include previously seen events,
|
||||||
|
/// and to exclude events that happened before the profiling session began.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<ProfilerEvent> FilterOldEvents(List<ProfilerEvent> events)
|
public List<ProfilerEvent> FilterOldEvents(List<ProfilerEvent> events)
|
||||||
{
|
{
|
||||||
@@ -149,13 +150,24 @@ namespace Microsoft.SqlTools.ServiceLayer.Profiler
|
|||||||
{
|
{
|
||||||
events.RemoveRange(0, idx + 1);
|
events.RemoveRange(0, idx + 1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// save the last event so we know where to clean-up the list from next time
|
// save the last event so we know where to clean-up the list from next time
|
||||||
if (events.Count > 0)
|
if (events.Count > 0)
|
||||||
{
|
{
|
||||||
lastSeenEvent = events.LastOrDefault();
|
lastSeenEvent = events.LastOrDefault();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else // first poll at start of session, all data is old
|
||||||
|
{
|
||||||
|
// save the last event as the beginning of the profiling session
|
||||||
|
if (events.Count > 0)
|
||||||
|
{
|
||||||
|
lastSeenEvent = events.LastOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ignore all events before the session began
|
||||||
|
events.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user