Skip to content

Commit

Permalink
update v0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Mon-ius committed Aug 11, 2024
1 parent c42731c commit b60451c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aw"
version = "0.0.1"
version = "0.0.2"
edition = "2021"

[dependencies]
Expand All @@ -23,7 +23,7 @@ name = "ld_"
path = "src/lib.rs"

[profile.release]
lto = false
lto = true
strip = true
panic = 'abort'
opt-level = 3
Expand Down
2 changes: 1 addition & 1 deletion src/client/warp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl WARP {

pub async fn get_license(&mut self, seed: String) -> Result<String, Box<dyn std::error::Error>>{
let license = self.update(seed).await.unwrap();
let seed = self.update(license.clone()).await.unwrap();
let _ = self.update(license.clone()).await.unwrap();
let _ = self.delete().await.unwrap();

Ok(license)
Expand Down
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@ const SEED: &str ="0U7h98No-L6987BhV-uDd80i36";

pub async fn run_tokio(num: usize) -> Result<(), Box<dyn std::error::Error>> {
let semaphore = std::sync::Arc::new(tokio::sync::Semaphore::new(CAPACITY));
let seed = std::env::var("SEED").unwrap_or_else(|_| SEED.to_string());

let tasks: Vec<_> = iter(0..num)
.map(|_| {
let semaphore = semaphore.clone();
let seed = seed.clone();
async move {
let permit = semaphore.acquire_owned().await.unwrap();
let license = match client::WARP::build().await {
Ok(mut a) => a.get_license(SEED.into()).await.unwrap(),
Ok(mut a) => a.get_license(seed).await.unwrap(),
Err(_) => format!("error"),
};

println!("{:#?}", license);
println!("{}", license);
drop(permit);
}
})
Expand Down

0 comments on commit b60451c

Please sign in to comment.