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();
|
_lists = (await NotificationRepository.GetAllNotificationListsAsync()).ToList();
|
||||||
_recipients.Clear();
|
_recipients.Clear();
|
||||||
var recipientTasks = _lists.ToDictionary(
|
foreach (var list in _lists)
|
||||||
list => list.Id,
|
|
||||||
list => NotificationRepository.GetRecipientsByListIdAsync(list.Id));
|
|
||||||
await Task.WhenAll(recipientTasks.Values);
|
|
||||||
foreach (var (id, task) in recipientTasks)
|
|
||||||
{
|
{
|
||||||
_recipients[id] = task.Result;
|
_recipients[list.Id] = await NotificationRepository.GetRecipientsByListIdAsync(list.Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
Reference in New Issue
Block a user