From bc0b47fe36d00c0aa27eddb3b1a8b255142317c0 Mon Sep 17 00:00:00 2001 From: vitor-aignosi Date: Tue, 15 Jul 2025 09:02:46 -0300 Subject: [PATCH] SIENTIAPDE-1150 refactor: update orchestration workflow to conditionally start schedule and slot report handlers based on report availability, improving clarity and efficiency --- orchestrator/workflows/orchestrator.py | 42 ++++++++++++++------------ 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/orchestrator/workflows/orchestrator.py b/orchestrator/workflows/orchestrator.py index 8d18fe0..202cce8 100644 --- a/orchestrator/workflows/orchestrator.py +++ b/orchestrator/workflows/orchestrator.py @@ -178,26 +178,30 @@ class Orchestrator: schedule_insertion_report = await schedule_insertion_report_handler schedule_update_report = await schedule_update_report_handler - schedule_report_handler = workflow.start_activity_method( - Activities.report_schedule_orchestration, - { - 'created_schedules': schedule_insertion_report, - 'updated_schedules': schedule_update_report, - 'deleted_schedules': schedule_deletion_report - }, - retry_policy=retry_policy, - start_to_close_timeout=timedelta(seconds=60) - ) + if schedule_insertion_report or schedule_update_report or schedule_deletion_report: - slot_report_handler = workflow.start_activity_method( - Activities.report_slot_orchestration, - { - 'inserted_slots': slot_insertion_report, - 'deleted_slots': slot_deletion_report - }, - retry_policy=retry_policy, - start_to_close_timeout=timedelta(seconds=60) - ) + schedule_report_handler = workflow.start_activity_method( + Activities.report_schedule_orchestration, + { + 'created_schedules': schedule_insertion_report, + 'updated_schedules': schedule_update_report, + 'deleted_schedules': schedule_deletion_report + }, + retry_policy=retry_policy, + start_to_close_timeout=timedelta(seconds=60) + ) + + if slot_insertion_report or slot_deletion_report: + + slot_report_handler = workflow.start_activity_method( + Activities.report_slot_orchestration, + { + 'inserted_slots': slot_insertion_report, + 'deleted_slots': slot_deletion_report + }, + retry_policy=retry_policy, + start_to_close_timeout=timedelta(seconds=60) + ) if schedule_update_report: