From 1d5af9d745eae9972b1115032419aa1c5d9ca329 Mon Sep 17 00:00:00 2001 From: bendn Date: Mon, 27 Feb 2023 13:54:49 +0700 Subject: [PATCH] parallel updates (#24) --- Cargo.toml | 3 ++- godot.lock | 15 +++++++++++++++ src/main.rs | 5 +++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9d89a32..b98ccc7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "godot-package-manager" -version = "1.1.1" +version = "1.1.2" edition = "2021" authors = ["bendn "] description = "A package manager for godot" @@ -26,6 +26,7 @@ console = "0.15.4" indicatif = "0.17.2" anyhow = "1.0.68" dialoguer = { version = "0.10.3", features = [] } +rayon = "1.6" [dev-dependencies] glob = "0.3.0" diff --git a/godot.lock b/godot.lock index 5cbfe64..895a832 100644 --- a/godot.lock +++ b/godot.lock @@ -1,4 +1,9 @@ [ + { + "name": "@bendn/splitter", + "version": "1.0.6", + "integrity": "sha512-HT7q5qv6OEpX95e5r+kAsasoAvH0Mgf+aT4SdKQ18fyDIn1dW02WqbulF0AMwHufgRZkMf9SnQGiAq79P5ZIKQ==" + }, { "name": "@bendn/test", "version": "2.0.10", @@ -8,5 +13,15 @@ "name": "@bendn/gdcli", "version": "1.2.5", "integrity": "sha512-/YOAd1+K4JlKvPTmpX8B7VWxGtFrxKq4R0A6u5qOaaVPK6uGsl4dGZaIHpxuqcurEcwPEOabkoShXKZaOXB0lw==" + }, + { + "name": "prettier", + "version": "2.8.4", + "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==" + }, + { + "name": "stockfish", + "version": "15.0.0", + "integrity": "sha512-ze3vTgMrnCmMdtC8qpONBdXkSHWwv4Dx+GFV1V5TIi0qP1HF+Vwa4lArgqvHDooU8Mwfs1cgRzkW3SM8x/7TJg==" } ] \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index e4660a7..1abc50d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,6 +12,7 @@ use std::fs::{create_dir, read_dir, read_to_string, remove_dir, write}; use std::io::{stdin, Read}; use std::path::{Path, PathBuf}; use std::{env::current_dir, panic, time::Instant}; +use rayon::prelude::*; #[derive(Parser)] #[command(name = "gpm")] @@ -194,8 +195,7 @@ fn update(cfg: &mut ConfigFile, modify: bool, not_verbose: bool) { }; let now = Instant::now(); packages - .into_iter() - .progress_with(bar.clone()) + .into_par_iter() .for_each(|mut p| { bar.set_message(format!("{p}")); p.download(); @@ -209,6 +209,7 @@ fn update(cfg: &mut ConfigFile, modify: bool, not_verbose: bool) { }); } } + bar.inc(1); bar.suspend(|| println!("{:>12} {p}", putils::green("Downloaded"))); }); println!(