chore: only gather notifications if not return_notifications?

This commit is contained in:
Zach Daniel 2023-04-12 17:38:45 -04:00
parent ba5a7e2cb7
commit dcd8f305b6

View file

@ -161,21 +161,20 @@ defmodule Ash.Engine do
if opts[:return_notifications?] do if opts[:return_notifications?] do
resource_notifications resource_notifications
else else
Ash.Notifier.notify(resource_notifications) notifications = Ash.Notifier.notify(resource_notifications)
end
notifications = if Process.get(:ash_engine_started_transaction?) do
if Process.get(:ash_engine_started_transaction?) do current_notifications = Process.get(:ash_engine_notifications, [])
current_notifications = Process.get(:ash_engine_notifications, [])
Process.put( Process.put(
:ash_engine_notifications, :ash_engine_notifications,
current_notifications ++ notifications current_notifications ++ notifications
) )
[] []
else else
notifications notifications
end
end end
{:ok, %{result | resource_notifications: notifications}} {:ok, %{result | resource_notifications: notifications}}