From 2e3c8f4cdc8d81b6a2f4842d849a64d7ce3d3926 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Sat, 31 May 2025 17:09:55 +0700 Subject: all: use case with ticker instead of default case in run --- worker.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worker.go b/worker.go index 6bc5c13..e9ff6bd 100644 --- a/worker.go +++ b/worker.go @@ -98,6 +98,7 @@ func (wrk *worker) run() (result *Result, err error) { go wrk.scan(linkq) } + var tick = time.NewTicker(500 * time.Millisecond) var listWaitStatus []linkQueue var isScanning = true for isScanning { @@ -149,7 +150,7 @@ func (wrk *worker) run() (result *Result, err error) { listWaitStatus = append(listWaitStatus, linkq) } - default: + case <-tick.C: wrk.wg.Wait() if len(wrk.resultq) != 0 { continue -- cgit v1.3