Skip to content

Commit

Permalink
feat: v0.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
skifli authored Oct 1, 2024
1 parent ad9e8f6 commit e3500f0
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion bruty_client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "bruty_client"
authors = ["skifli"]
version = "0.2.4"
version = "0.2.5"
edition = "2021"

[dependencies]
Expand Down
7 changes: 5 additions & 2 deletions bruty_client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ async fn create_connection(remote_url: &str, id: i16, secret: String) {
.await;
}

#[tokio::main]
#[tokio::main(flavor = "multi_thread")]
async fn main() {
let args: Args = Args::parse();
let remote_url = "wss://bruty.shuttleapp.rs/ivocord";
Expand All @@ -293,7 +293,10 @@ async fn main() {

log::info!("Bruty Client v{} by {}.", VERSION, AUTHOR);

let server_status_client = reqwest::Client::new();
let server_status_client = reqwest::Client::builder()
.timeout(std::time::Duration::from_millis(100))
.build()
.unwrap();

loop {
let req = server_status_client
Expand Down
32 changes: 16 additions & 16 deletions bruty_client/src/payload_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,11 @@ pub async fn test_request_data(

let id_generator = IdGenerator::new(test_request_data.id.clone());

let futures = futures::stream::FuturesUnordered::new();

for id in id_generator {
let bodies = futures::stream::FuturesUnordered::from_iter(
id_generator.map(|id| {
let client = &reqwest_client_clone;

futures.push(async move {
async move {
let id_vec = id.clone();
let id_str = id.iter().collect::<String>();

Expand Down Expand Up @@ -157,19 +156,20 @@ pub async fn test_request_data(
}
}
}
});
}

let positives: Vec<_> = futures.filter_map(|result| async {
if let Some(video) = result {
match video.event {
bruty_share::types::VideoEvent::Success | bruty_share::types::VideoEvent::NotEmbeddable => Some(video),
}
} else {
None
}
}).collect().await;

}));

let positives = bodies
.filter_map(|video_option| async {
match video_option {
Some(video) => match video.event {
bruty_share::types::VideoEvent::NotEmbeddable | bruty_share::types::VideoEvent::Success => Some(video),
},
None => None,
}
})
.collect::<Vec<bruty_share::types::Video>>()
.await;

let elapsed_time = start_time.elapsed().as_secs_f64();

Expand Down
2 changes: 1 addition & 1 deletion bruty_server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "bruty_server"
authors = ["skifli"]
version = "0.2.4"
version = "0.2.5"
edition = "2021"

[dependencies]
Expand Down
3 changes: 3 additions & 0 deletions bruty_server/src/server_threads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ pub async fn results_progress_handler(
"Can't update current ID to {}, awaiting {:?}",
cant_update.iter().collect::<String>(),
awaiting_results
.iter()
.map(|x| x.iter().collect::<String>())
.collect::<Vec<String>>()
);
}
}
Expand Down

0 comments on commit e3500f0

Please sign in to comment.