diff --git a/src/aws_durable_execution_sdk_python_testing/checkpoint/processors/wait.py b/src/aws_durable_execution_sdk_python_testing/checkpoint/processors/wait.py index ae20723..01cc69b 100644 --- a/src/aws_durable_execution_sdk_python_testing/checkpoint/processors/wait.py +++ b/src/aws_durable_execution_sdk_python_testing/checkpoint/processors/wait.py @@ -2,6 +2,8 @@ from __future__ import annotations +import logging +import os from datetime import UTC, datetime, timedelta from typing import TYPE_CHECKING @@ -41,8 +43,12 @@ def process( wait_seconds = ( update.wait_options.wait_seconds if update.wait_options else 0 ) + time_scale = float(os.getenv("DURABLE_EXECUTION_TIME_SCALE", "1.0")) + logging.info("Using DURABLE_EXECUTION_TIME_SCALE: %f", time_scale) + scaled_wait_seconds = wait_seconds * time_scale + scheduled_end_timestamp = datetime.now(UTC) + timedelta( - seconds=wait_seconds + seconds=scaled_wait_seconds ) # Create WaitDetails with scheduled timestamp @@ -72,7 +78,7 @@ def process( notifier.notify_wait_timer_scheduled( execution_arn=execution_arn, operation_id=update.operation_id, - delay=wait_seconds, + delay=scaled_wait_seconds, ) return wait_operation case OperationAction.CANCEL: diff --git a/src/aws_durable_execution_sdk_python_testing/model.py b/src/aws_durable_execution_sdk_python_testing/model.py index 27da2d8..0b91153 100644 --- a/src/aws_durable_execution_sdk_python_testing/model.py +++ b/src/aws_durable_execution_sdk_python_testing/model.py @@ -1760,7 +1760,7 @@ def create_wait_event_started(cls, context: EventCreationContext) -> Event: and wait_details.scheduled_end_timestamp and context.operation.start_timestamp ): - duration = int( + duration = round( ( wait_details.scheduled_end_timestamp - context.operation.start_timestamp @@ -1789,7 +1789,7 @@ def create_wait_event_succeeded(cls, context: EventCreationContext) -> Event: and wait_details.scheduled_end_timestamp and context.operation.start_timestamp ): - duration = int( + duration = round( ( wait_details.scheduled_end_timestamp - context.start_timestamp ).total_seconds()