Commit 20a333d
fix: await pending heartbeats instead of cancelling them
- Rename _cancel_pending_heartbeats to _wait_pending_heartbeats and
remove task.cancel() so heartbeat RPCs complete before activity exits
- Change _heartbeat_tasks type to set[Future] to accommodate both
asyncio.Task (async path) and wrapped concurrent.futures.Future (sync)
- Track heartbeat futures in _SyncContext via asyncio.wrap_future() and
add try/finally to _SyncContext.execute() to await them
- Remove asyncio.sleep(0.1) workarounds in tests since heartbeats are
now guaranteed to complete before execute() returns
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent baba59d commit 20a333d
File tree
2 files changed
+11
-13
lines changed- cadence/_internal/activity
- tests/cadence/_internal/activity
2 files changed
+11
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
40 | 38 | | |
41 | 39 | | |
42 | 40 | | |
| |||
73 | 71 | | |
74 | 72 | | |
75 | 73 | | |
76 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
86 | | - | |
| 87 | + | |
87 | 88 | | |
88 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
Lines changed: 0 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | 329 | | |
333 | 330 | | |
334 | 331 | | |
| |||
359 | 356 | | |
360 | 357 | | |
361 | 358 | | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | 359 | | |
366 | 360 | | |
367 | 361 | | |
| |||
0 commit comments