From 666f55767b73e218d880e8ec2982ea1b239bf5da Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Wed, 24 Dec 2025 02:56:22 +0000 Subject: [PATCH] hotfix(autoheal): monitor health errors asynchronously with other setup steps - May resolve #3021 - no need to wait for dns, port forwarding etc. to setup to monitor health errors --- internal/vpn/tunnelup.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/vpn/tunnelup.go b/internal/vpn/tunnelup.go index de975d53..60aac1e0 100644 --- a/internal/vpn/tunnelup.go +++ b/internal/vpn/tunnelup.go @@ -51,6 +51,11 @@ func (l *Loop) onTunnelUp(ctx, loopCtx context.Context, data tunnelUpData) { l.logger.Info("👉 See https://github.com/qdm12/gluetun-wiki/blob/main/faq/healthcheck.md") } + // Start collecting health errors asynchronously, since + // we should not wait for the code below to complete + // to start monitoring health and auto-healing. + go l.collectHealthErrors(ctx, loopCtx, healthErrCh) + if *l.dnsLooper.GetSettings().ServerEnabled { _, _ = l.dnsLooper.ApplyStatus(ctx, constants.Running) } else { @@ -79,8 +84,6 @@ func (l *Loop) onTunnelUp(ctx, loopCtx context.Context, data tunnelUpData) { if err != nil { l.logger.Error(err.Error()) } - - l.collectHealthErrors(ctx, loopCtx, healthErrCh) } func (l *Loop) collectHealthErrors(ctx, loopCtx context.Context, healthErrCh <-chan error) {