mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-28 01:25:44 -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>
|
||||
/// 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>
|
||||
public List<ProfilerEvent> FilterOldEvents(List<ProfilerEvent> events)
|
||||
{
|
||||
@@ -149,12 +150,23 @@ namespace Microsoft.SqlTools.ServiceLayer.Profiler
|
||||
{
|
||||
events.RemoveRange(0, idx + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// save the last event so we know where to clean-up the list from next time
|
||||
if (events.Count > 0)
|
||||
// save the last event so we know where to clean-up the list from next time
|
||||
if (events.Count > 0)
|
||||
{
|
||||
lastSeenEvent = events.LastOrDefault();
|
||||
}
|
||||
}
|
||||
else // first poll at start of session, all data is old
|
||||
{
|
||||
lastSeenEvent = events.LastOrDefault();
|
||||
// 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;
|
||||
|
||||
Reference in New Issue
Block a user