Added missing async awaits in notifications that ensures objects are not disposed too early
Fixes https://github.com/umbraco/Umbraco-CMS/issues/14574
This commit is contained in:
@@ -238,7 +238,7 @@ internal class NotificationAsyncHandlerWrapperImpl<TNotificationType> : Notifica
|
||||
/// confusion.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public override Task HandleAsync<TNotification, TNotificationHandler>(
|
||||
public override async Task HandleAsync<TNotification, TNotificationHandler>(
|
||||
IEnumerable<TNotification> notifications,
|
||||
CancellationToken cancellationToken,
|
||||
ServiceFactory serviceFactory,
|
||||
@@ -256,7 +256,7 @@ internal class NotificationAsyncHandlerWrapperImpl<TNotificationType> : Notifica
|
||||
.Select(x => new Func<IEnumerable<TNotification>, CancellationToken, Task>(
|
||||
(handlerNotifications, handlerCancellationToken) => x.HandleAsync(handlerNotifications.Cast<TNotificationType>(), handlerCancellationToken)));
|
||||
|
||||
return publish(handlers, notifications, cancellationToken);
|
||||
await publish(handlers, notifications, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,13 +42,13 @@ public partial class EventAggregator : IEventAggregator
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task PublishAsync<TNotification, TNotificationHandler>(IEnumerable<TNotification> notifications, CancellationToken cancellationToken = default)
|
||||
public async Task PublishAsync<TNotification, TNotificationHandler>(IEnumerable<TNotification> notifications, CancellationToken cancellationToken = default)
|
||||
where TNotification : INotification
|
||||
where TNotificationHandler : INotificationHandler
|
||||
{
|
||||
PublishNotifications<TNotification, TNotificationHandler>(notifications);
|
||||
|
||||
return PublishNotificationsAsync<TNotification, TNotificationHandler>(notifications, cancellationToken);
|
||||
await PublishNotificationsAsync<TNotification, TNotificationHandler>(notifications, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user