From dcfd53f22f82716889bd537d42069a2f6dc69856 Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Mon, 24 Jun 2024 21:33:55 -0400 Subject: [PATCH] chore: add back in and improve tmp_ref logic --- lib/ash/actions/destroy/bulk.ex | 9 +++++++-- lib/ash/actions/update/bulk.ex | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/ash/actions/destroy/bulk.ex b/lib/ash/actions/destroy/bulk.ex index dd01a75e..c4a0355c 100644 --- a/lib/ash/actions/destroy/bulk.ex +++ b/lib/ash/actions/destroy/bulk.ex @@ -1217,6 +1217,8 @@ defmodule Ash.Actions.Destroy.Bulk do Ash.DataLayer.transaction( List.wrap(resource) ++ action.touches_resources, fn -> + tmp_ref = make_ref() + result = do_handle_batch( batch, @@ -1225,7 +1227,7 @@ defmodule Ash.Actions.Destroy.Bulk do action, opts, all_changes, - ref, + tmp_ref, base_changeset, must_return_records_for_changes?, changes, @@ -1233,10 +1235,13 @@ defmodule Ash.Actions.Destroy.Bulk do ) {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) + notifications = Process.get({:bulk_update_notifications, tmp_ref}) || [] + store_notification(ref, notifications, opts) + result end, opts[:timeout], diff --git a/lib/ash/actions/update/bulk.ex b/lib/ash/actions/update/bulk.ex index 4d7c8ef6..16c20c0c 100644 --- a/lib/ash/actions/update/bulk.ex +++ b/lib/ash/actions/update/bulk.ex @@ -1465,6 +1465,9 @@ defmodule Ash.Actions.Update.Bulk do store_error(ref, new_errors, opts, new_error_count) + notifications = Process.get({:bulk_update_notifications, tmp_ref}) || [] + store_notification(ref, notifications, opts) + result end, opts[:timeout],