From 04ea19331cbed732fa0ccacc40775881e4a6058c Mon Sep 17 00:00:00 2001 From: Benny~ Date: Tue, 3 Mar 2020 19:56:00 +0800 Subject: [PATCH] prefetch in background --- webp-server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webp-server.go b/webp-server.go index 6682d79..c6bbc57 100644 --- a/webp-server.go +++ b/webp-server.go @@ -302,7 +302,7 @@ func prefetchImages(confImgPath string, ExhaustPath string, QUALITY string) { go webpEncoder(picAbsPath, p2, float32(q), false, finishChan) count += <-finishChan //progress bar - _, _ = fmt.Fprintf(os.Stdout, "Convert in progress: %d/%d\r", count, all) + _, _ = fmt.Fprintf(os.Stdout, "[Webp Server started] - convert in progress: %d/%d\r", count, all) return nil }) if err != nil { @@ -342,7 +342,7 @@ func main() { } if prefetch { - prefetchImages(confImgPath, ExhaustPath, QUALITY) + go prefetchImages(confImgPath, ExhaustPath, QUALITY) } app := fiber.New()