Repository navigation
Commit 8ea44a2
Performance: reduce orchestration history replay allocations
Long orchestration histories were copied and rescanned several times per
work item before and during replay:
- `TaskHubGrpcWorker._execute_orchestrator()` built
`list(req.pastEvents) + list(req.newEvents)` (three throwaway lists sized
by the full history) purely to locate the first `executionStarted` event.
It now iterates `itertools.chain(...)` and still breaks at the first match.
- `_OrchestrationExecutor.execute()` materialized every `executionStarted`
event in the committed history but only read element `[0]`. It now uses
`next(...)` over a generator, short-circuiting at the first match and
falling back to `"<unknown>"` exactly as before.
- `_OrchestrationExecutor._build_rewind_result()` built a combined
`list(old_events) + list(new_events)` for its two passes. Both inputs are
sequences, so each pass now chains them lazily in the same order.
Replay order, rewind handling, non-determinism detection, log messages and
exception types/messages are all unchanged; this is an allocation-only
change with no observable behavior difference.
Adds regression tests covering both branches of the orchestration-name
lookup (resolved from committed history, and the "<unknown>" fallback).
Fixes #185
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d6a6454c-5bdc-4bc7-9059-a2789a65e2711 parent 4d87430 commit 8ea44a2
2 files changed
Lines changed: 59 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
1132 | 1133 | | |
1133 | 1134 | | |
1134 | 1135 | | |
1135 | | - | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
1136 | 1139 | | |
1137 | 1140 | | |
1138 | | - | |
| 1141 | + | |
1139 | 1142 | | |
1140 | 1143 | | |
1141 | 1144 | | |
| |||
2132 | 2135 | | |
2133 | 2136 | | |
2134 | 2137 | | |
2135 | | - | |
2136 | | - | |
2137 | | - | |
2138 | | - | |
| 2138 | + | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
2139 | 2144 | | |
2140 | 2145 | | |
2141 | 2146 | | |
| |||
2286 | 2291 | | |
2287 | 2292 | | |
2288 | 2293 | | |
2289 | | - | |
2290 | 2294 | | |
2291 | 2295 | | |
2292 | 2296 | | |
2293 | 2297 | | |
2294 | 2298 | | |
2295 | | - | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
2296 | 2302 | | |
2297 | | - | |
| 2303 | + | |
2298 | 2304 | | |
2299 | 2305 | | |
2300 | 2306 | | |
2301 | 2307 | | |
2302 | 2308 | | |
2303 | | - | |
| 2309 | + | |
2304 | 2310 | | |
2305 | 2311 | | |
2306 | 2312 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
96 | 139 | | |
97 | 140 | | |
98 | 141 | | |
| |||
0 commit comments