diff --git a/hyper_cgi/Cargo.toml b/hyper_cgi/Cargo.toml index f5e3c4fbe..3b05902be 100644 --- a/hyper_cgi/Cargo.toml +++ b/hyper_cgi/Cargo.toml @@ -2,7 +2,7 @@ name = "hyper_cgi" version = "22.10.25" authors = ["Christian Schilling ", "Louis-Marie Givel "] -edition = "2018" +edition = "2021" license-file = "LICENSE" description = "Run CGI scripts with hyper" repository = "https://github.com/josh-project/josh" diff --git a/josh-core/Cargo.toml b/josh-core/Cargo.toml index ccffeada9..2e8d64981 100644 --- a/josh-core/Cargo.toml +++ b/josh-core/Cargo.toml @@ -7,7 +7,7 @@ license-file = "LICENSE" description = "GIT virtualization proxy" keywords = ["git", "monorepo", "workflow", "scm"] readme = "README.md" -edition = "2018" +edition = "2021" [dependencies] backtrace = "0.3.69" diff --git a/josh-filter/Cargo.toml b/josh-filter/Cargo.toml index 30f76a08a..84a9687ac 100644 --- a/josh-filter/Cargo.toml +++ b/josh-filter/Cargo.toml @@ -1,7 +1,7 @@ [package] authors = ["Christian Schilling "] description = "GIT filter cli" -edition = "2018" +edition = "2021" keywords = ["git", "monorepo", "workflow", "scm"] license-file = "LICENSE" name = "josh-filter" diff --git a/josh-proxy/Cargo.toml b/josh-proxy/Cargo.toml index 62141572e..5dd0c44d9 100644 --- a/josh-proxy/Cargo.toml +++ b/josh-proxy/Cargo.toml @@ -1,7 +1,7 @@ [package] authors = ["Christian Schilling "] description = "GIT virtualization proxy" -edition = "2018" +edition = "2021" keywords = ["git", "monorepo", "workflow", "scm"] license-file = "LICENSE" name = "josh-proxy" diff --git a/josh-proxy/src/bin/josh-proxy.rs b/josh-proxy/src/bin/josh-proxy.rs index 4e387b45d..6fac078c4 100644 --- a/josh-proxy/src/bin/josh-proxy.rs +++ b/josh-proxy/src/bin/josh-proxy.rs @@ -129,6 +129,15 @@ async fn fetch_upstream( let refs_to_fetch: Vec<_> = refs_to_fetch.iter().map(|x| x.to_string()).collect(); + let us = upstream_repo.clone(); + let semaphore = service + .fetch_permits + .lock()? + .entry(us.clone()) + .or_insert(Arc::new(tokio::sync::Semaphore::new(1))) + .clone(); + let permit = semaphore.acquire().await; + let fetch_timer_ok = { if let Some(last) = service.fetch_timers.read()?.get(&key) { let since = std::time::Instant::now().duration_since(*last); @@ -183,15 +192,7 @@ async fn fetch_upstream( let br_path = service.repo_path.join("mirror"); let span = tracing::span!(tracing::Level::TRACE, "fetch worker"); - let us = upstream_repo.clone(); let ru = remote_url.clone(); - let semaphore = service - .fetch_permits - .lock()? - .entry(us.clone()) - .or_insert(Arc::new(tokio::sync::Semaphore::new(1))) - .clone(); - let permit = semaphore.acquire().await; let task_remote_auth = remote_auth.clone(); let fetch_result = tokio::task::spawn_blocking(move || { let _span_guard = span.enter(); diff --git a/josh-proxy/src/lib.rs b/josh-proxy/src/lib.rs index 556955732..029c92586 100644 --- a/josh-proxy/src/lib.rs +++ b/josh-proxy/src/lib.rs @@ -510,7 +510,6 @@ fn create_repo_base(path: &PathBuf) -> josh::JoshResult { .cloned() .try_for_each(|(key, value)| -> JoshResult<()> { use gix::config::parse::section::Key; - use std::convert::TryFrom; let key = Key::try_from(key) .map_err(|_| josh_error("unable to create config section"))?; diff --git a/josh-rpc/Cargo.toml b/josh-rpc/Cargo.toml index 1292845da..a6acd43bd 100644 --- a/josh-rpc/Cargo.toml +++ b/josh-rpc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "josh-rpc" version = "0.1.0" -edition = "2018" +edition = "2021" [dependencies] serde = { workspace = true } diff --git a/josh-ssh-shell/Cargo.toml b/josh-ssh-shell/Cargo.toml index ce57d5704..95502efb6 100644 --- a/josh-ssh-shell/Cargo.toml +++ b/josh-ssh-shell/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "josh-ssh-shell" version = "0.1.0" -edition = "2018" +edition = "2021" [dependencies] clap = { workspace = true }