From c45af53b265fbeca2395f5abed5d1fcc9da83e8e Mon Sep 17 00:00:00 2001 From: Nova Kwok Date: Sat, 29 Feb 2020 19:03:26 +0800 Subject: [PATCH] Use goroutine for prefetch (#12) --- webp-server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webp-server.go b/webp-server.go index 67b564f..85bcaec 100644 --- a/webp-server.go +++ b/webp-server.go @@ -229,7 +229,7 @@ func prefetchImages(confImgPath string, QUALITY string) { _, p2 := genWebpAbs(picAbsPath, info.Name(), proposedURI) q, _ := strconv.ParseFloat(QUALITY, 32) _ = os.MkdirAll(path.Dir(p2), os.ModePerm) - _ = webpEncoder(picAbsPath, p2, float32(q), false) + go webpEncoder(picAbsPath, p2, float32(q), false) count += 1 // progress bar _, _ = fmt.Fprintf(os.Stdout, "Convert in progress: %d/%d\r", count, all)