App: replace a silent socket instead of hanging; blink the terminal cursor on a timer; keep one markdown cache entry per streamed reply
A socket that outlived a sleep or network change looked open, so every queued request waited its own 30 s timeout behind the last until the page was reopened. The client now replaces a socket whose request times out unheard (or after two timeouts in a row), and probes it with a ping after a quiet spell or on returning to the foreground. The terminal's blinking cursor ran a Ticker (a frame every vsync); a 530 ms timer now flips it. Streamed deltas no longer flood the markdown cache and evict finished answers. Adds tool/perf/idle_session_bench.mjs (idle frames, long-session heap, snapshot census) and notes/perf-hangs-idle.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -302,7 +302,10 @@ void main() {
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
final client = PipelinesClient(channelFactory: (_) => channel);
|
||||
final client = PipelinesClient(
|
||||
replaceSilentSocket: false,
|
||||
channelFactory: (_) => channel,
|
||||
);
|
||||
final provider = PlatformRouteInformationProvider(
|
||||
initialRouteInformation: RouteInformation(uri: Uri.parse('/chat/s1')),
|
||||
);
|
||||
@@ -410,7 +413,10 @@ void main() {
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
final client = PipelinesClient(channelFactory: (_) => channel);
|
||||
final client = PipelinesClient(
|
||||
replaceSilentSocket: false,
|
||||
channelFactory: (_) => channel,
|
||||
);
|
||||
final provider = PlatformRouteInformationProvider(
|
||||
initialRouteInformation: RouteInformation(uri: Uri.parse('/chat/old')),
|
||||
);
|
||||
@@ -492,7 +498,10 @@ void main() {
|
||||
addTearDown(tester.view.reset);
|
||||
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
final client = PipelinesClient(channelFactory: (_) => channel);
|
||||
final client = PipelinesClient(
|
||||
replaceSilentSocket: false,
|
||||
channelFactory: (_) => channel,
|
||||
);
|
||||
final provider = PlatformRouteInformationProvider(
|
||||
initialRouteInformation: RouteInformation(uri: Uri.parse('/chat')),
|
||||
);
|
||||
@@ -702,7 +711,10 @@ void main() {
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
final client = PipelinesClient(channelFactory: (_) => channel);
|
||||
final client = PipelinesClient(
|
||||
replaceSilentSocket: false,
|
||||
channelFactory: (_) => channel,
|
||||
);
|
||||
final provider = PlatformRouteInformationProvider(
|
||||
initialRouteInformation: RouteInformation(uri: Uri.parse('/chat')),
|
||||
);
|
||||
@@ -784,7 +796,10 @@ void main() {
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
final client = PipelinesClient(channelFactory: (_) => channel);
|
||||
final client = PipelinesClient(
|
||||
replaceSilentSocket: false,
|
||||
channelFactory: (_) => channel,
|
||||
);
|
||||
final provider = PlatformRouteInformationProvider(
|
||||
initialRouteInformation: RouteInformation(uri: Uri.parse('/chat')),
|
||||
);
|
||||
@@ -839,7 +854,10 @@ void main() {
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
final client = PipelinesClient(channelFactory: (_) => channel);
|
||||
final client = PipelinesClient(
|
||||
replaceSilentSocket: false,
|
||||
channelFactory: (_) => channel,
|
||||
);
|
||||
final provider = PlatformRouteInformationProvider(
|
||||
initialRouteInformation: RouteInformation(uri: Uri.parse('/chat')),
|
||||
);
|
||||
@@ -908,7 +926,10 @@ void main() {
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
final client = PipelinesClient(channelFactory: (_) => channel);
|
||||
final client = PipelinesClient(
|
||||
replaceSilentSocket: false,
|
||||
channelFactory: (_) => channel,
|
||||
);
|
||||
final provider = PlatformRouteInformationProvider(
|
||||
initialRouteInformation: RouteInformation(uri: Uri.parse('/chat/a')),
|
||||
);
|
||||
@@ -957,7 +978,10 @@ void main() {
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
final client = PipelinesClient(channelFactory: (_) => channel);
|
||||
final client = PipelinesClient(
|
||||
replaceSilentSocket: false,
|
||||
channelFactory: (_) => channel,
|
||||
);
|
||||
final provider = PlatformRouteInformationProvider(
|
||||
initialRouteInformation: RouteInformation(uri: Uri.parse('/chat')),
|
||||
);
|
||||
|
||||
@@ -15,7 +15,10 @@ void main() {
|
||||
) async {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
final client = PipelinesClient(channelFactory: (_) => channel);
|
||||
final client = PipelinesClient(
|
||||
replaceSilentSocket: false,
|
||||
channelFactory: (_) => channel,
|
||||
);
|
||||
final provider = PlatformRouteInformationProvider(
|
||||
initialRouteInformation: RouteInformation(uri: Uri.parse('/runs')),
|
||||
);
|
||||
|
||||
@@ -37,7 +37,10 @@ void main() {
|
||||
PipelinesApp(
|
||||
androidSupported: false,
|
||||
server: webServer(),
|
||||
client: PipelinesClient(channelFactory: (_) => channel),
|
||||
client: PipelinesClient(
|
||||
replaceSilentSocket: false,
|
||||
channelFactory: (_) => channel,
|
||||
),
|
||||
routeInformationProvider: provider,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -31,7 +31,10 @@ mount(
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
final client = PipelinesClient(channelFactory: (_) => channel);
|
||||
final client = PipelinesClient(
|
||||
replaceSilentSocket: false,
|
||||
channelFactory: (_) => channel,
|
||||
);
|
||||
final provider = PlatformRouteInformationProvider(
|
||||
initialRouteInformation: RouteInformation(uri: Uri.parse(route)),
|
||||
);
|
||||
|
||||
@@ -16,7 +16,10 @@ import 'templates_wiring_test.dart' show pumpApp, readTemplates;
|
||||
void main() {
|
||||
testWidgets('the gallery and detail scroll behind the bar', (tester) async {
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
final client = PipelinesClient(channelFactory: (_) => channel);
|
||||
final client = PipelinesClient(
|
||||
replaceSilentSocket: false,
|
||||
channelFactory: (_) => channel,
|
||||
);
|
||||
final provider = PlatformRouteInformationProvider(
|
||||
initialRouteInformation: RouteInformation(uri: Uri.parse('/pipelines')),
|
||||
);
|
||||
|
||||
@@ -135,6 +135,7 @@ void main() {
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
var sockets = 0;
|
||||
final client = PipelinesClient(
|
||||
replaceSilentSocket: false,
|
||||
channelFactory: (_) {
|
||||
sockets++;
|
||||
return channel;
|
||||
@@ -229,6 +230,7 @@ void main() {
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
var sockets = 0;
|
||||
final client = PipelinesClient(
|
||||
replaceSilentSocket: false,
|
||||
channelFactory: (_) {
|
||||
sockets++;
|
||||
return channel;
|
||||
|
||||
Reference in New Issue
Block a user