From 21e73cb065df28f06cec614fca681c345535ed3e Mon Sep 17 00:00:00 2001 From: Dirk Julich Date: Fri, 20 Mar 2026 17:28:10 +0100 Subject: [PATCH] AAP-57614 fix: write event_queries_processed directly to DB The previous commit dispatched save_indirect_host_entries from artifacts_handler, but used delay_update to set event_queries_processed to False. delay_update only queues the write for the final job status save, so save_indirect_host_entries would read the default (True) from the DB and bail out before processing. Replace delay_update(event_queries_processed=False) with a direct Job.objects.filter().update() call so the value is visible in the DB before save_indirect_host_entries runs. Co-Authored-By: Claude Opus 4.6 --- awx/main/tasks/callback.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/awx/main/tasks/callback.py b/awx/main/tasks/callback.py index 6db56b27ce..72ee37cbd8 100644 --- a/awx/main/tasks/callback.py +++ b/awx/main/tasks/callback.py @@ -278,7 +278,6 @@ class RunnerCallback: def artifacts_handler(self, artifact_dir): success, query_file_contents = try_load_query_file(artifact_dir) if success: - self.delay_update(event_queries_processed=False) collections_info = collect_queries(query_file_contents) for collection, data in collections_info.items(): version = data['version'] @@ -302,6 +301,15 @@ class RunnerCallback: else: logger.warning(f'The file {COLLECTION_FILENAME} unexpectedly did not contain ansible_version') + # Write event_queries_processed=False directly to the DB rather + # than using delay_update, because delay_update only writes when + # the final job status is saved. save_indirect_host_entries + # checks this column under select_for_update and would bail out + # if it still saw the default (True). + from awx.main.models import Job + + Job.objects.filter(id=self.instance.id).update(event_queries_processed=False) + # Dispatch save_indirect_host_entries to process the EventQuery # records created above. handle_success_and_failure_notifications # may have already run and skipped dispatching because