From 33bf5b673fa1a552983b60448596de74df9994cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20So=C3=B3s?= Date: Mon, 18 Sep 2023 13:31:59 +0200 Subject: [PATCH] Don't block traffic to old instances too early during search isolate renewal. (#7045) --- CHANGELOG.md | 1 + app/lib/service/entrypoint/_isolate.dart | 5 ++++- app/lib/service/entrypoint/_messages.dart | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6822cc9c7..4e920031b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ Important changes to data models, configuration, and migrations between each AppEngine version, listed here to ease deployment and troubleshooting. ## Next Release (replace with git tag when deployed) + * Fix: search isolate renewal doesn't block ongoing traffic. ## `20230914t133300-all` * Bumped runtimeVersion to `2023.09.12`. diff --git a/app/lib/service/entrypoint/_isolate.dart b/app/lib/service/entrypoint/_isolate.dart index fe366cdae4..3ad1869a00 100644 --- a/app/lib/service/entrypoint/_isolate.dart +++ b/app/lib/service/entrypoint/_isolate.dart @@ -64,10 +64,13 @@ class IsolateRunner { required Duration wait, }) async { final isolatesToClose = [..._isolates]; + + await start(count); + // prevent traffic to hit the old instances for (final i in isolatesToClose) { i.markedForRenew = true; } - await start(count); + await Future.delayed(wait); for (final i in isolatesToClose) { await i.close(); diff --git a/app/lib/service/entrypoint/_messages.dart b/app/lib/service/entrypoint/_messages.dart index c8b984272c..224fbe629c 100644 --- a/app/lib/service/entrypoint/_messages.dart +++ b/app/lib/service/entrypoint/_messages.dart @@ -222,4 +222,7 @@ class IsolateRequestException implements Exception { final String message; IsolateRequestException(this.message); + + @override + String toString() => 'IsolateRequestException: $message'; }