From 290625e90f54b2936b38891578793104e558414b Mon Sep 17 00:00:00 2001 From: Jonas Finnemann Jensen Date: Mon, 11 Nov 2024 13:58:37 +0100 Subject: [PATCH] Keep service scope alive (#8270) --- app/lib/service/entrypoint/analyzer.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/lib/service/entrypoint/analyzer.dart b/app/lib/service/entrypoint/analyzer.dart index fe5c00412..acc0d40c8 100644 --- a/app/lib/service/entrypoint/analyzer.dart +++ b/app/lib/service/entrypoint/analyzer.dart @@ -66,6 +66,7 @@ Future _workerMain(EntryMessage message) async { await popularityStorage.start(); await downloadCountsBackend.start(); await taskBackend.start(); + registerScopeExitCallback(() => taskBackend.stop()); setupAnalyzerPeriodicTasks(); setupSearchPeriodicTasks(); @@ -86,4 +87,8 @@ Future _apiExporterMain(EntryMessage message) async { await popularityStorage.start(); await downloadCountsBackend.start(); await apiExporter!.start(); + registerScopeExitCallback(() => apiExporter!.stop()); + + // wait indefinitely + await Completer().future; }