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:
@@ -137,7 +137,7 @@ internal class NotificationAsyncHandlerWrapperImpl<TNotification> : Notification
|
||||
/// confusion.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public override Task HandleAsync(
|
||||
public override async Task HandleAsync(
|
||||
INotification notification,
|
||||
CancellationToken cancellationToken,
|
||||
ServiceFactory serviceFactory,
|
||||
@@ -155,7 +155,7 @@ internal class NotificationAsyncHandlerWrapperImpl<TNotification> : Notification
|
||||
(theNotification, theToken) =>
|
||||
x.HandleAsync((TNotification)theNotification, theToken)));
|
||||
|
||||
return publish(handlers, notification, cancellationToken);
|
||||
await publish(handlers, notification, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public partial class EventAggregator : IEventAggregator
|
||||
=> _serviceFactory = serviceFactory;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task PublishAsync<TNotification>(TNotification notification, CancellationToken cancellationToken = default)
|
||||
public async Task PublishAsync<TNotification>(TNotification notification, CancellationToken cancellationToken = default)
|
||||
where TNotification : INotification
|
||||
{
|
||||
// TODO: Introduce codegen efficient Guard classes to reduce noise.
|
||||
@@ -60,7 +60,7 @@ public partial class EventAggregator : IEventAggregator
|
||||
}
|
||||
|
||||
PublishNotification(notification);
|
||||
return PublishNotificationAsync(notification, cancellationToken);
|
||||
await PublishNotificationAsync(notification, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user