fix(central-ui): load notification-list recipients sequentially to avoid concurrent DbContext use
This commit is contained in:
@@ -104,13 +104,9 @@
|
||||
{
|
||||
_lists = (await NotificationRepository.GetAllNotificationListsAsync()).ToList();
|
||||
_recipients.Clear();
|
||||
var recipientTasks = _lists.ToDictionary(
|
||||
list => list.Id,
|
||||
list => NotificationRepository.GetRecipientsByListIdAsync(list.Id));
|
||||
await Task.WhenAll(recipientTasks.Values);
|
||||
foreach (var (id, task) in recipientTasks)
|
||||
foreach (var list in _lists)
|
||||
{
|
||||
_recipients[id] = task.Result;
|
||||
_recipients[list.Id] = await NotificationRepository.GetRecipientsByListIdAsync(list.Id);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user