fix(central-ui): load notification-list recipients sequentially to avoid concurrent DbContext use

This commit is contained in:
Joseph Doherty
2026-05-19 06:34:32 -04:00
parent 7ecf6448e3
commit 547a7b98e5

View File

@@ -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)