From eae3d96088e87edfcb79e59f1c57a21252196ecd Mon Sep 17 00:00:00 2001 From: sunshineplan Date: Wed, 23 Oct 2024 13:30:08 +0800 Subject: [PATCH] converter: Upgrade workers --- converter/go.mod | 2 +- converter/go.sum | 4 ++-- converter/main.go | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/converter/go.mod b/converter/go.mod index afc015d..fcfc2a7 100644 --- a/converter/go.mod +++ b/converter/go.mod @@ -6,7 +6,7 @@ require ( github.com/sunshineplan/imgconv v0.0.0-00010101000000-000000000000 github.com/sunshineplan/tiff v0.0.0-20220128141034-29b9d69bd906 github.com/sunshineplan/utils v0.1.73 - github.com/sunshineplan/workers v1.0.1 + github.com/sunshineplan/workers v1.0.3 ) require ( diff --git a/converter/go.sum b/converter/go.sum index efb2383..5b2c985 100644 --- a/converter/go.sum +++ b/converter/go.sum @@ -17,8 +17,8 @@ github.com/sunshineplan/tiff v0.0.0-20220128141034-29b9d69bd906 h1:+yYRCj+PGQNnn github.com/sunshineplan/tiff v0.0.0-20220128141034-29b9d69bd906/go.mod h1:O+Ar7ouRbdfxLgoZLFz447/dvdM1NVKk1VpOQaijvAU= github.com/sunshineplan/utils v0.1.73 h1:Kvi45QYzdvNqQKON5Q67M7U/35+RrOnX7K8sbZtHsgI= github.com/sunshineplan/utils v0.1.73/go.mod h1:61jHA9jn2CVlZzt9LbPz+MpOEiR6Jy5SNHHEcc/KQNk= -github.com/sunshineplan/workers v1.0.1 h1:vhDo4ZaerVu0QM1udRmWpvHY2U61/vTLRVwmKcYOxNw= -github.com/sunshineplan/workers v1.0.1/go.mod h1:EjLgk5vd/2ig6vdWDAZy/fpkzdSm8IVDsARPQVSyQy0= +github.com/sunshineplan/workers v1.0.3 h1:9NSB3nm9yxZFT/ZU4DaOXdWJ56Y2WXh238apdZUdA44= +github.com/sunshineplan/workers v1.0.3/go.mod h1:wUlVWxvfwTiuULOw4atF17bgeL30gIMI6gE050reEVw= golang.org/x/image v0.21.0 h1:c5qV36ajHpdj4Qi0GnE0jUc/yuo33OLFaa0d+crTD5s= golang.org/x/image v0.21.0/go.mod h1:vUbsLavqK/W303ZroQQVKQ+Af3Yl6Uz1Ppu5J/cLz78= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= diff --git a/converter/main.go b/converter/main.go index 8de4066..9c83a80 100644 --- a/converter/main.go +++ b/converter/main.go @@ -38,7 +38,7 @@ var ( width = flag.Int("width", 0, "") height = flag.Int("height", 0, "") percent = flag.Float64("percent", 0, "") - worker = flag.Int64("worker", 5, "") + worker = flag.Int("worker", 5, "") debug = flag.Bool("debug", false, "") format imgconv.Format @@ -137,7 +137,7 @@ func main() { log.Println("Total images:", total) pb := progressbar.New(total) pb.Start() - workers.NewWorkers(*worker).Run(context.Background(), workers.SliceJob(images, func(_ int, image string) { + workers.Workers(*worker).Run(context.Background(), workers.SliceJob(images, func(_ int, image string) { defer pb.Add(1) if _, err := open(image); err != nil { log.Error("Bad image", "image", image, "error", err) @@ -214,7 +214,7 @@ func main() { log.Println("Total images:", total) pb := progressbar.New(total) pb.Start() - workers.NewWorkers(*worker).Run(context.Background(), workers.SliceJob(images, func(_ int, image string) { + workers.Workers(*worker).Run(context.Background(), workers.SliceJob(images, func(_ int, image string) { defer pb.Add(1) rel, err := filepath.Rel(*src, image) if err != nil {