Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lite/Controls/ServerTab.Refresh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private async System.Threading.Tasks.Task RefreshAlertCountsAsync(int hoursBack,
{
try
{
var (blockingCount, deadlockCount, latestEventTime) = await _dataService.GetAlertCountsAsync(_serverId, hoursBack, fromDate, toDate);
var (blockingCount, deadlockCount, latestEventTime) = await Task.Run(() => _dataService.GetAlertCountsAsync(_serverId, hoursBack, fromDate, toDate));
AlertCountsChanged?.Invoke(blockingCount, deadlockCount, latestEventTime);
}
catch (Exception ex)
Expand Down
16 changes: 8 additions & 8 deletions Lite/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1549,7 +1549,7 @@ await _emailAlertService.TrySendAlertEmailAsync(
{
try
{
var blockingRows = await _dataService.GetRecentBlockedProcessReportsAsync(summary.ServerId, hoursBack: 1);
var blockingRows = await Task.Run(() => _dataService.GetRecentBlockedProcessReportsAsync(summary.ServerId, hoursBack: 1));
effectiveBlockingCount = blockingRows
.Count(r => string.IsNullOrEmpty(r.DatabaseName) ||
!App.AlertExcludedDatabases.Any(e =>
Expand Down Expand Up @@ -1622,7 +1622,7 @@ await _emailAlertService.TrySendAlertEmailAsync(
{
try
{
var deadlockRows = await _dataService.GetRecentDeadlocksAsync(summary.ServerId, hoursBack: 1);
var deadlockRows = await Task.Run(() => _dataService.GetRecentDeadlocksAsync(summary.ServerId, hoursBack: 1));
effectiveDeadlockCount = deadlockRows
.Count(r => !IsDeadlockExcluded(r, App.AlertExcludedDatabases));
}
Expand Down Expand Up @@ -1691,7 +1691,7 @@ await _emailAlertService.TrySendAlertEmailAsync(
{
try
{
var poisonWaits = await _dataService.GetLatestPoisonWaitAvgsAsync(summary.ServerId);
var poisonWaits = await Task.Run(() => _dataService.GetLatestPoisonWaitAvgsAsync(summary.ServerId));
var triggered = poisonWaits.FindAll(w => w.AvgMsPerWait >= App.AlertPoisonWaitThresholdMs);

if (triggered.Count > 0)
Expand Down Expand Up @@ -1760,7 +1760,7 @@ await _emailAlertService.TrySendAlertEmailAsync(
{
try
{
var longRunning = await _dataService.GetLongRunningQueriesAsync(summary.ServerId, App.AlertLongRunningQueryThresholdMinutes, App.AlertLongRunningQueryMaxResults, App.AlertLongRunningQueryExcludeSpServerDiagnostics, App.AlertLongRunningQueryExcludeWaitFor, App.AlertLongRunningQueryExcludeBackups, App.AlertLongRunningQueryExcludeMiscWaits, App.AlertLongRunningQueryExcludeCdc);
var longRunning = await Task.Run(() => _dataService.GetLongRunningQueriesAsync(summary.ServerId, App.AlertLongRunningQueryThresholdMinutes, App.AlertLongRunningQueryMaxResults, App.AlertLongRunningQueryExcludeSpServerDiagnostics, App.AlertLongRunningQueryExcludeWaitFor, App.AlertLongRunningQueryExcludeBackups, App.AlertLongRunningQueryExcludeMiscWaits, App.AlertLongRunningQueryExcludeCdc));

if (App.AlertExcludedDatabases.Count > 0)
{
Expand Down Expand Up @@ -1841,7 +1841,7 @@ await _emailAlertService.TrySendAlertEmailAsync(
{
try
{
var tempDb = await _dataService.GetLatestTempDbSpaceAsync(summary.ServerId);
var tempDb = await Task.Run(() => _dataService.GetLatestTempDbSpaceAsync(summary.ServerId));

if (tempDb != null && tempDb.UsedPercent >= App.AlertTempDbSpaceThresholdPercent)
{
Expand Down Expand Up @@ -1903,7 +1903,7 @@ await _emailAlertService.TrySendAlertEmailAsync(
{
try
{
var anomalousJobs = await _dataService.GetAnomalousJobsAsync(summary.ServerId, App.AlertLongRunningJobMultiplier);
var anomalousJobs = await Task.Run(() => _dataService.GetAnomalousJobsAsync(summary.ServerId, App.AlertLongRunningJobMultiplier));

/* _lastLongRunningJobAlert is keyed per job *run* ({server}:{jobId}:{startTime}),
so unlike the per-server cooldown dicts it grows without bound. Drop entries
Expand Down Expand Up @@ -2003,7 +2003,7 @@ private static string TruncateText(string text, int maxLength = 300)
{
if (_dataService == null) return null;

var events = await _dataService.GetRecentBlockedProcessReportsAsync(serverId, hoursBack: 1);
var events = await Task.Run(() => _dataService.GetRecentBlockedProcessReportsAsync(serverId, hoursBack: 1));
if (events == null || events.Count == 0) return null;

if (App.AlertExcludedDatabases.Count > 0)
Expand Down Expand Up @@ -2063,7 +2063,7 @@ private static string TruncateText(string text, int maxLength = 300)
{
if (_dataService == null) return null;

var deadlocks = await _dataService.GetRecentDeadlocksAsync(serverId, hoursBack: 1);
var deadlocks = await Task.Run(() => _dataService.GetRecentDeadlocksAsync(serverId, hoursBack: 1));
if (deadlocks == null || deadlocks.Count == 0) return null;

if (App.AlertExcludedDatabases.Count > 0)
Expand Down
Loading