Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from __future__ import annotations

import logging
import os
from datetime import UTC, datetime, timedelta
from typing import TYPE_CHECKING

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/aws_durable_execution_sdk_python_testing/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
Loading