mirror of
https://github.com/ansible/awx.git
synced 2026-03-23 03:45:01 -02:30
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user