From bad953b9f0c80fedeed5da8f1f84b1c2994292ce Mon Sep 17 00:00:00 2001
From: Jian Wang <w13915984028@gmail.com>
Date: Mon, 25 Jul 2022 14:33:03 +0200
Subject: [PATCH] fix63 use sleep instead of force scheduling

---
 listener.go | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/listener.go b/listener.go
index 3150499..a0758b8 100644
--- a/listener.go
+++ b/listener.go
@@ -7,7 +7,6 @@ import (
 	"crypto/x509"
 	"net"
 	"net/http"
-	"runtime"
 	"strings"
 	"sync"
 	"time"
@@ -163,9 +162,9 @@ type listener struct {
 func (l *listener) WrapExpiration(days int) net.Listener {
 	ctx, cancel := context.WithCancel(context.Background())
 	go func() {
-		// busy-wait for certificate preload to complete
+		// loop on short sleeps until certificate preload completes
 		for l.cert == nil {
-			runtime.Gosched()
+			time.Sleep(time.Millisecond)
 		}
 
 		for {