From 441e858a78e2ef3e1833082bdb6c41e5c778b2ce Mon Sep 17 00:00:00 2001 From: Hiddify Date: Mon, 11 Mar 2024 13:28:42 +0100 Subject: [PATCH] a test for possible bug in some windows --- lib/bootstrap.dart | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/bootstrap.dart b/lib/bootstrap.dart index c9abc2fb..a02ea5e0 100644 --- a/lib/bootstrap.dart +++ b/lib/bootstrap.dart @@ -63,7 +63,7 @@ Future lazyBootstrap( ); final enableAnalytics = - await container.read(analyticsControllerProvider.future); + true || await container.read(analyticsControllerProvider.future); if (enableAnalytics) { await _init( "analytics", @@ -178,6 +178,7 @@ Future _init( Future Function() initializer, { int? timeout, }) async { + Logger.bootstrap.warning("$name starting seconds"); final stopWatch = Stopwatch()..start(); Logger.bootstrap.info("initializing [$name]"); Future func() => timeout != null @@ -187,13 +188,20 @@ Future _init( final result = await func(); Logger.bootstrap .debug("[$name] initialized in ${stopWatch.elapsedMilliseconds}ms"); + + Logger.bootstrap.warning("$name done successfully waiting 2 seconds"); + await Future.delayed(Duration(seconds: 2)); return result; } catch (e, stackTrace) { Logger.bootstrap.error("[$name] error initializing", e, stackTrace); + Logger.bootstrap.warning("$name done with error waiting 2 seconds"); + await Future.delayed(Duration(seconds: 2)); rethrow; } finally { stopWatch.stop(); } + Logger.bootstrap.warning("$name done with unknown state waiting 2 seconds"); + await Future.delayed(Duration(seconds: 2)); } Future _safeInit(