Kaynağa Gözat

feat: use goroutines to save images

v0lp3 4 yıl önce
ebeveyn
işleme
94eede11f4
1 değiştirilmiş dosya ile 6 ekleme ve 1 silme
  1. 6 1
      src/main.go

+ 6 - 1
src/main.go

@@ -24,6 +24,11 @@ func main() {
 	rawImages, width, heigth := Scan(*brotherIP, brotherPort, *resolution, *color, *adf)
 
 	for i, rawImage := range rawImages {
-		SaveImage(rawImage, width, heigth, fmt.Sprintf("%s(%d)", *name, i), *color)
+		if i == len(rawImages)-1 {
+			SaveImage(rawImage, width, heigth, fmt.Sprintf("%s(%d)", *name, i), *color)
+
+		} else {
+			go SaveImage(rawImage, width, heigth, fmt.Sprintf("%s(%d)", *name, i), *color)
+		}
 	}
 }