File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
src/aws_durable_execution_sdk_python_testing Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 22
33from __future__ import annotations
44
5+ import logging
6+ import os
57from datetime import UTC , datetime , timedelta
68from typing import TYPE_CHECKING
79
@@ -41,8 +43,12 @@ def process(
4143 wait_seconds = (
4244 update .wait_options .wait_seconds if update .wait_options else 0
4345 )
46+ time_scale = float (os .getenv ("DURABLE_EXECUTION_TIME_SCALE" , "1.0" ))
47+ logging .info ("Using DURABLE_EXECUTION_TIME_SCALE: %f" , time_scale )
48+ scaled_wait_seconds = wait_seconds * time_scale
49+
4450 scheduled_end_timestamp = datetime .now (UTC ) + timedelta (
45- seconds = wait_seconds
51+ seconds = scaled_wait_seconds
4652 )
4753
4854 # Create WaitDetails with scheduled timestamp
@@ -72,7 +78,7 @@ def process(
7278 notifier .notify_wait_timer_scheduled (
7379 execution_arn = execution_arn ,
7480 operation_id = update .operation_id ,
75- delay = wait_seconds ,
81+ delay = scaled_wait_seconds ,
7682 )
7783 return wait_operation
7884 case OperationAction .CANCEL :
Original file line number Diff line number Diff line change @@ -1760,7 +1760,7 @@ def create_wait_event_started(cls, context: EventCreationContext) -> Event:
17601760 and wait_details .scheduled_end_timestamp
17611761 and context .operation .start_timestamp
17621762 ):
1763- duration = int (
1763+ duration = round (
17641764 (
17651765 wait_details .scheduled_end_timestamp
17661766 - context .operation .start_timestamp
@@ -1789,7 +1789,7 @@ def create_wait_event_succeeded(cls, context: EventCreationContext) -> Event:
17891789 and wait_details .scheduled_end_timestamp
17901790 and context .operation .start_timestamp
17911791 ):
1792- duration = int (
1792+ duration = round (
17931793 (
17941794 wait_details .scheduled_end_timestamp - context .start_timestamp
17951795 ).total_seconds ()
You can’t perform that action at this time.
0 commit comments