Commit 41313e5
committed
feat(sprites): lazy-warm named-attach sessions
When attaching to an existing sprite (created_by_us=False),
SpritesSandboxSession now skips the eager wait-for-running poll
and lets the first I/O operation drive the wake-up via a new
_ensure_warm() guard. The platform auto-wakes a paused sprite when
traffic arrives, so this is essentially free — and avoids paying
1–10s of polling latency just to hand back a session handle.
The created-by-us path is unchanged: a fresh sprite still needs a
provisioning poll, and we set _warmth_verified=True after.
A new _invalidate_warmth() hook lets recovery flows force a re-poll
after a transport error.
Live timing of named-attach:
- create(): 3s → 0.01s
- first exec: adds the wake-up roundtrip (formerly paid eagerly)
- subsequent I/O: unchanged (cached warm flag)
3 new lazy-warm tests; the _attach test helper now also marks
_warmth_verified=True so existing tests that bypass startup keep
working.1 parent 7c4f725 commit 41313e5
2 files changed
Lines changed: 131 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
| 260 | + | |
260 | 261 | | |
261 | 262 | | |
262 | 263 | | |
| |||
276 | 277 | | |
277 | 278 | | |
278 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
279 | 286 | | |
280 | 287 | | |
281 | 288 | | |
| |||
336 | 343 | | |
337 | 344 | | |
338 | 345 | | |
339 | | - | |
340 | | - | |
341 | | - | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
342 | 367 | | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
343 | 380 | | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
352 | 387 | | |
353 | 388 | | |
354 | 389 | | |
| |||
586 | 621 | | |
587 | 622 | | |
588 | 623 | | |
| 624 | + | |
| 625 | + | |
589 | 626 | | |
590 | 627 | | |
591 | 628 | | |
| |||
656 | 693 | | |
657 | 694 | | |
658 | 695 | | |
| 696 | + | |
659 | 697 | | |
660 | 698 | | |
661 | 699 | | |
| |||
972 | 1010 | | |
973 | 1011 | | |
974 | 1012 | | |
| 1013 | + | |
975 | 1014 | | |
976 | 1015 | | |
977 | 1016 | | |
| |||
1003 | 1042 | | |
1004 | 1043 | | |
1005 | 1044 | | |
| 1045 | + | |
1006 | 1046 | | |
1007 | 1047 | | |
1008 | 1048 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
50 | 56 | | |
51 | 57 | | |
52 | 58 | | |
53 | 59 | | |
54 | 60 | | |
55 | 61 | | |
56 | 62 | | |
| 63 | + | |
57 | 64 | | |
58 | 65 | | |
59 | 66 | | |
| |||
1072 | 1079 | | |
1073 | 1080 | | |
1074 | 1081 | | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
0 commit comments