refactor(trigger): rename trigger references to event for consistency

- Updated variable names and types from 'trigger' to 'event' across multiple files to enhance clarity and maintain consistency in the codebase.
- Adjusted related data structures and API responses to reflect the new naming convention.
- Improved type annotations and error handling in the workflow trigger run API and associated services.
This commit is contained in:
Harry
2025-10-09 03:12:35 +08:00
parent a33d04d1ac
commit 91318d3d04
22 changed files with 114 additions and 96 deletions

View File

@ -87,8 +87,8 @@ def dispatch_triggered_workflows_async(
dispatched_count = 0
for event_name in events:
try:
trigger = controller.get_event(event_name)
if trigger is None:
event = controller.get_event(event_name)
if event is None:
logger.error(
"Trigger '%s' not found in provider '%s'",
event_name,
@ -98,7 +98,7 @@ def dispatch_triggered_workflows_async(
dispatched_count += TriggerService.dispatch_triggered_workflows(
subscription=subscription,
trigger=trigger,
event=event,
request_id=request_id,
)
@ -118,7 +118,8 @@ def dispatch_triggered_workflows_async(
pool_key: str = PluginTriggerDebugEvent.build_pool_key(
tenant_id=subscription.tenant_id,
subscription_id=subscription_id,
trigger_name=event_name,
event_name=event_name,
provider_id=provider_id,
)
event = PluginTriggerDebugEvent(
subscription_id=subscription_id,
@ -141,11 +142,6 @@ def dispatch_triggered_workflows_async(
len(events),
)
# Note: Stored request is not deleted here. It should be handled by:
# 1. Storage system's lifecycle policy (e.g., S3 lifecycle rules for triggers/* prefix)
# 2. Or periodic cleanup job if using local/persistent storage
# This ensures request data is available for debugging/retry purposes
return {
"status": "completed",
"total_count": len(events),