Merge pull request #4 from modrinth/many-fixes-again
Fix forge syncing not working
This commit is contained in:
commit
fd19bb7cd5
2
.env
2
.env
@ -1,4 +1,4 @@
|
|||||||
RUST_LOG=info,error
|
RUST_LOG=info
|
||||||
|
|
||||||
BASE_URL=https://modrinth-cdn-staging.nyc3.digitaloceanspaces.com
|
BASE_URL=https://modrinth-cdn-staging.nyc3.digitaloceanspaces.com
|
||||||
|
|
||||||
|
|||||||
22
Dockerfile
22
Dockerfile
@ -1,7 +1,21 @@
|
|||||||
FROM rust:1.68.2
|
FROM rust:1.68.2 as build
|
||||||
|
ENV PKG_CONFIG_ALLOW_CROSS=1
|
||||||
COPY ./ ./
|
|
||||||
|
|
||||||
|
WORKDIR /usr/src/daedalus
|
||||||
|
COPY . .
|
||||||
RUN cargo build --release
|
RUN cargo build --release
|
||||||
|
|
||||||
CMD ["./target/release/daedalus_client"]
|
|
||||||
|
FROM debian:bullseye-slim
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends ca-certificates \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN update-ca-certificates
|
||||||
|
|
||||||
|
COPY --from=build /usr/src/daedalus/target/release/daedalus_client /daedalus/daedalus_client
|
||||||
|
WORKDIR /daedalus_client
|
||||||
|
|
||||||
|
CMD /daedalus/daedalus_client
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "daedalus"
|
name = "daedalus"
|
||||||
version = "0.1.18"
|
version = "0.1.19"
|
||||||
authors = ["Jai A <jaiagr+gpg@pm.me>"]
|
authors = ["Jai A <jaiagr+gpg@pm.me>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|||||||
@ -131,7 +131,7 @@ pub fn merge_partial_version(
|
|||||||
asset_index: merge.asset_index,
|
asset_index: merge.asset_index,
|
||||||
assets: merge.assets,
|
assets: merge.assets,
|
||||||
downloads: merge.downloads,
|
downloads: merge.downloads,
|
||||||
id: merge.id,
|
id: partial.id.replace(DUMMY_REPLACE_STRING, &merge_id),
|
||||||
java_version: merge.java_version,
|
java_version: merge.java_version,
|
||||||
libraries: partial
|
libraries: partial
|
||||||
.libraries
|
.libraries
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "daedalus_client"
|
name = "daedalus_client"
|
||||||
version = "0.1.18"
|
version = "0.1.19"
|
||||||
authors = ["Jai A <jaiagr+gpg@pm.me>"]
|
authors = ["Jai A <jaiagr+gpg@pm.me>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|||||||
@ -82,6 +82,7 @@ pub async fn retrieve_data(
|
|||||||
visited_artifacts_mutex.lock().await;
|
visited_artifacts_mutex.lock().await;
|
||||||
|
|
||||||
if visited_assets.contains(&lib.name) {
|
if visited_assets.contains(&lib.name) {
|
||||||
|
lib.name = lib.name.replace(DUMMY_GAME_VERSION, DUMMY_REPLACE_STRING);
|
||||||
lib.url = Some(format_url("maven/"));
|
lib.url = Some(format_url("maven/"));
|
||||||
|
|
||||||
return Ok(lib);
|
return Ok(lib);
|
||||||
@ -92,7 +93,6 @@ pub async fn retrieve_data(
|
|||||||
|
|
||||||
if lib.name.contains(DUMMY_GAME_VERSION) {
|
if lib.name.contains(DUMMY_GAME_VERSION) {
|
||||||
lib.name = lib.name.replace(DUMMY_GAME_VERSION, DUMMY_REPLACE_STRING);
|
lib.name = lib.name.replace(DUMMY_GAME_VERSION, DUMMY_REPLACE_STRING);
|
||||||
lib.url = Some(format_url("maven/"));
|
|
||||||
futures::future::try_join_all(list.game.clone().into_iter().map(|game_version| async {
|
futures::future::try_join_all(list.game.clone().into_iter().map(|game_version| async {
|
||||||
let semaphore = semaphore.clone();
|
let semaphore = semaphore.clone();
|
||||||
let uploaded_files_mutex = uploaded_files_mutex.clone();
|
let uploaded_files_mutex = uploaded_files_mutex.clone();
|
||||||
@ -130,6 +130,7 @@ pub async fn retrieve_data(
|
|||||||
|
|
||||||
Ok::<(), Error>(())
|
Ok::<(), Error>(())
|
||||||
})).await?;
|
})).await?;
|
||||||
|
lib.url = Some(format_url("maven/"));
|
||||||
|
|
||||||
return Ok(lib);
|
return Ok(lib);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::Instant;
|
||||||
use tokio::sync::{Mutex, Semaphore};
|
use tokio::sync::{Mutex, Semaphore};
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
@ -93,7 +93,7 @@ pub async fn retrieve_data(
|
|||||||
|
|
||||||
if !loaders.is_empty() {
|
if !loaders.is_empty() {
|
||||||
version_futures.push(async {
|
version_futures.push(async {
|
||||||
let loaders_versions = Vec::new();
|
let mut loaders_versions = Vec::new();
|
||||||
|
|
||||||
{
|
{
|
||||||
let loaders_futures = loaders.into_iter().map(|(loader_version_full, version)| async {
|
let loaders_futures = loaders.into_iter().map(|(loader_version_full, version)| async {
|
||||||
@ -464,8 +464,9 @@ pub async fn retrieve_data(
|
|||||||
while versions.peek().is_some() {
|
while versions.peek().is_some() {
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
|
|
||||||
let chunk: Vec<_> = versions.by_ref().take(1).collect();
|
let chunk: Vec<_> = versions.by_ref().take(10).collect();
|
||||||
futures::future::try_join_all(chunk).await?;
|
let res = futures::future::try_join_all(chunk).await?;
|
||||||
|
loaders_versions.extend(res.into_iter().flatten());
|
||||||
|
|
||||||
chunk_index += 1;
|
chunk_index += 1;
|
||||||
|
|
||||||
@ -493,7 +494,7 @@ pub async fn retrieve_data(
|
|||||||
while versions.peek().is_some() {
|
while versions.peek().is_some() {
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
|
|
||||||
let chunk: Vec<_> = versions.by_ref().take(10).collect();
|
let chunk: Vec<_> = versions.by_ref().take(1).collect();
|
||||||
futures::future::try_join_all(chunk).await?;
|
futures::future::try_join_all(chunk).await?;
|
||||||
|
|
||||||
chunk_index += 1;
|
chunk_index += 1;
|
||||||
|
|||||||
@ -44,7 +44,7 @@ async fn main() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut timer = tokio::time::interval(Duration::from_secs(30 * 60));
|
let mut timer = tokio::time::interval(Duration::from_secs(60 * 60));
|
||||||
let semaphore = Arc::new(Semaphore::new(50));
|
let semaphore = Arc::new(Semaphore::new(50));
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
@ -189,11 +189,7 @@ pub async fn upload_file_to_bucket(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn format_url(path: &str) -> String {
|
pub fn format_url(path: &str) -> String {
|
||||||
format!(
|
format!("{}/{}", &*dotenvy::var("BASE_URL").unwrap(), path)
|
||||||
"{}/{}",
|
|
||||||
&*dotenvy::var("BASE_URL").unwrap(),
|
|
||||||
path
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn download_file(
|
pub async fn download_file(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user