chore: add back in and improve tmp_ref logic

This commit is contained in:
Zach Daniel 2024-06-24 21:33:55 -04:00
parent daf4b08ab1
commit dcfd53f22f
2 changed files with 10 additions and 2 deletions

View file

@ -1217,6 +1217,8 @@ defmodule Ash.Actions.Destroy.Bulk do
Ash.DataLayer.transaction( Ash.DataLayer.transaction(
List.wrap(resource) ++ action.touches_resources, List.wrap(resource) ++ action.touches_resources,
fn -> fn ->
tmp_ref = make_ref()
result = result =
do_handle_batch( do_handle_batch(
batch, batch,
@ -1225,7 +1227,7 @@ defmodule Ash.Actions.Destroy.Bulk do
action, action,
opts, opts,
all_changes, all_changes,
ref, tmp_ref,
base_changeset, base_changeset,
must_return_records_for_changes?, must_return_records_for_changes?,
changes, changes,
@ -1233,10 +1235,13 @@ defmodule Ash.Actions.Destroy.Bulk do
) )
{new_errors, new_error_count} = {new_errors, new_error_count} =
Process.delete({:bulk_destroy_errors, ref}) || {[], 0} Process.delete({:bulk_destroy_errors, tmp_ref}) || {[], 0}
store_error(ref, new_errors, opts, new_error_count) store_error(ref, new_errors, opts, new_error_count)
notifications = Process.get({:bulk_update_notifications, tmp_ref}) || []
store_notification(ref, notifications, opts)
result result
end, end,
opts[:timeout], opts[:timeout],

View file

@ -1465,6 +1465,9 @@ defmodule Ash.Actions.Update.Bulk do
store_error(ref, new_errors, opts, new_error_count) store_error(ref, new_errors, opts, new_error_count)
notifications = Process.get({:bulk_update_notifications, tmp_ref}) || []
store_notification(ref, notifications, opts)
result result
end, end,
opts[:timeout], opts[:timeout],