Fix crash
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@@ -229,9 +230,9 @@ public class MailService : BaseDatabaseService, IMailService
|
|||||||
mails = await Connection.QueryAsync<MailCopy>(query);
|
mails = await Connection.QueryAsync<MailCopy>(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<Guid, MailItemFolder> folderCache = [];
|
ConcurrentDictionary<Guid, MailItemFolder> folderCache = new();
|
||||||
Dictionary<Guid, MailAccount> accountCache = [];
|
ConcurrentDictionary<Guid, MailAccount> accountCache = new();
|
||||||
Dictionary<string, AccountContact> contactCache = [];
|
ConcurrentDictionary<string, AccountContact> contactCache = new();
|
||||||
|
|
||||||
// Populate Folder Assignment for each single mail, to be able later group by "MailAccountId".
|
// Populate Folder Assignment for each single mail, to be able later group by "MailAccountId".
|
||||||
// This is needed to execute threading strategy by account type.
|
// This is needed to execute threading strategy by account type.
|
||||||
@@ -321,7 +322,7 @@ public class MailService : BaseDatabaseService, IMailService
|
|||||||
/// This method should used for operations with multiple mailItems. Don't use this for single mail items.
|
/// This method should used for operations with multiple mailItems. Don't use this for single mail items.
|
||||||
/// Called method should provide own instances for caches.
|
/// Called method should provide own instances for caches.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private async Task LoadAssignedPropertiesWithCacheAsync(MailCopy mail, Dictionary<Guid, MailItemFolder> folderCache, Dictionary<Guid, MailAccount> accountCache, Dictionary<string, AccountContact> contactCache)
|
private async Task LoadAssignedPropertiesWithCacheAsync(MailCopy mail, ConcurrentDictionary<Guid, MailItemFolder> folderCache, ConcurrentDictionary<Guid, MailAccount> accountCache, ConcurrentDictionary<string, AccountContact> contactCache)
|
||||||
{
|
{
|
||||||
if (mail is MailCopy mailCopy)
|
if (mail is MailCopy mailCopy)
|
||||||
{
|
{
|
||||||
@@ -1168,9 +1169,9 @@ public class MailService : BaseDatabaseService, IMailService
|
|||||||
var mailCopies = await Connection.QueryAsync<MailCopy>(query);
|
var mailCopies = await Connection.QueryAsync<MailCopy>(query);
|
||||||
if (mailCopies?.Count == 0) return [];
|
if (mailCopies?.Count == 0) return [];
|
||||||
|
|
||||||
Dictionary<Guid, MailItemFolder> folderCache = [];
|
ConcurrentDictionary<Guid, MailItemFolder> folderCache = new();
|
||||||
Dictionary<Guid, MailAccount> accountCache = [];
|
ConcurrentDictionary<Guid, MailAccount> accountCache = new();
|
||||||
Dictionary<string, AccountContact> contactCache = [];
|
ConcurrentDictionary<string, AccountContact> contactCache = new();
|
||||||
|
|
||||||
foreach (var mail in mailCopies)
|
foreach (var mail in mailCopies)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user