@@ -7438,7 +7438,7 @@ async def heartbeat_activity(
7438
7438
# If we are on the second attempt, we have retried due to pause/unpause.
7439
7439
if activity .info ().attempt > 1 :
7440
7440
return activity .cancellation_details ()
7441
- await asyncio .sleep (1 )
7441
+ await asyncio .sleep (0. 1 )
7442
7442
except (CancelledError , asyncio .CancelledError ) as err :
7443
7443
if not catch_err :
7444
7444
raise err
@@ -7455,7 +7455,7 @@ def sync_heartbeat_activity(
7455
7455
# If we are on the second attempt, we have retried due to pause/unpause.
7456
7456
if activity .info ().attempt > 1 :
7457
7457
return activity .cancellation_details ()
7458
- time .sleep (1 )
7458
+ time .sleep (0. 1 )
7459
7459
except (CancelledError , asyncio .CancelledError ) as err :
7460
7460
if not catch_err :
7461
7461
raise err
@@ -7550,7 +7550,7 @@ async def run(
7550
7550
False ,
7551
7551
activity_id = activity_id ,
7552
7552
start_to_close_timeout = timedelta (seconds = 10 ),
7553
- heartbeat_timeout = timedelta (seconds = 2 ),
7553
+ heartbeat_timeout = timedelta (seconds = 1 ),
7554
7554
retry_policy = RetryPolicy (maximum_attempts = 2 ),
7555
7555
)
7556
7556
)
@@ -7560,7 +7560,7 @@ async def run(
7560
7560
False ,
7561
7561
activity_id = f"{ activity_id } -2" ,
7562
7562
start_to_close_timeout = timedelta (seconds = 10 ),
7563
- heartbeat_timeout = timedelta (seconds = 2 ),
7563
+ heartbeat_timeout = timedelta (seconds = 1 ),
7564
7564
retry_policy = RetryPolicy (maximum_attempts = 2 ),
7565
7565
)
7566
7566
)
@@ -7575,6 +7575,8 @@ async def test_activity_pause_unpause(client: Client):
7575
7575
workflows = [ActivityHeartbeatPauseUnpauseWorkflow ],
7576
7576
activities = [heartbeat_activity , sync_heartbeat_activity ],
7577
7577
activity_executor = executor ,
7578
+ max_heartbeat_throttle_interval = timedelta (milliseconds = 300 ),
7579
+ default_heartbeat_throttle_interval = timedelta (milliseconds = 300 ),
7578
7580
) as worker :
7579
7581
test_activity_id = f"heartbeat-activity-{ uuid .uuid4 ()} "
7580
7582
@@ -7596,8 +7598,7 @@ async def test_activity_pause_unpause(client: Client):
7596
7598
7597
7599
# Wait for next heartbeat to propagate the cancellation. Unpausing before the heartbeat
7598
7600
# will show activity as unpaused to core. Consequently, it will *not* issue an activity cancel.
7599
- time .sleep (2 )
7600
-
7601
+ time .sleep (0.3 )
7601
7602
# Unpause activity
7602
7603
await unpause_and_assert (client , handle , activity_info_1 .activity_id )
7603
7604
# Expect second activity to have started now
@@ -7609,7 +7610,7 @@ async def test_activity_pause_unpause(client: Client):
7609
7610
# Pause activity then assert it is paused
7610
7611
await pause_and_assert (client , handle , activity_info_2 .activity_id )
7611
7612
# Wait for next heartbeat to propagate the cancellation.
7612
- time .sleep (2 )
7613
+ time .sleep (0.3 )
7613
7614
# Unpause activity
7614
7615
await unpause_and_assert (client , handle , activity_info_2 .activity_id )
7615
7616
0 commit comments