Hello everyone,
I’ve noticed that the ContentPublishingNotification
in Umbraco is being triggered twice when publishing content. This causes my INotificationHandler<ContentPublishingNotification>
to execute twice, which leads to unintended behavior in my logic.
I would like to understand:
- Why does
ContentPublishingNotification
trigger twice during a single publish action? - Is there a way to prevent this behavior so that my
NotificationHandler
only runs once per publish event?
Here is my current handler implementation:
public class AuditLogCreatedNotificationHandler : INotificationAsyncHandler<ContentPublishingNotification>
{
public AuditLogCreatedNotificationHandler()
{
}
public async Task HandleAsync(ContentPublishingNotification notification, CancellationToken cancellationToken)
{
// business logic
}
}
Has anyone else experienced this issue? Is there a recommended way to ensure the notification is only triggered once?
Thanks in advance for any insights!