Skip to content

Commit

Permalink
converter: Upgrade workers (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshineplan authored Oct 23, 2024
1 parent 18ebb15 commit 0833c97
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion converter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
4 changes: 2 additions & 2 deletions converter/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
6 changes: 3 additions & 3 deletions converter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 0833c97

Please sign in to comment.