mirror of
https://github.com/Syfaro/fuzzysearch.git
synced 2024-12-24 14:25:35 +00:00
Updates.
This commit is contained in:
parent
9f70ae0aca
commit
0453a84511
1168
Cargo.lock
generated
1168
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
19
Cargo.toml
19
Cargo.toml
@ -5,21 +5,20 @@ authors = ["Syfaro <syfaro@huefox.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
reqwest = { version = "*", features = ["json"] }
|
||||
tokio = { version = "0.2", features = ["full"] }
|
||||
futures = { version = "*", features = ["thread-pool"] }
|
||||
reqwest = { version = "0.11", features = ["json"] }
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
futures = { version = "0.3", features = ["thread-pool"] }
|
||||
hamming = "0.1.3"
|
||||
|
||||
serde = "*"
|
||||
serde_json = "*"
|
||||
serde = "1"
|
||||
serde_json = "1"
|
||||
|
||||
tokio-postgres = { version = "0.5.1", features = ["with-serde_json-1"] }
|
||||
bb8 = { git = "https://github.com/khuey/bb8.git" }
|
||||
bb8-postgres = { git = "https://github.com/khuey/bb8.git" }
|
||||
tokio-postgres = { version = "0.7", features = ["with-serde_json-1"] }
|
||||
bb8 = "0.7"
|
||||
bb8-postgres = "0.7"
|
||||
|
||||
furaffinity-rs = { git = "https://github.com/Syfaro/furaffinity-rs.git" }
|
||||
image = "0.23"
|
||||
img_hash = "*"
|
||||
img_hash = "3"
|
||||
|
||||
[profile.dev.package."*"]
|
||||
opt-level = 2
|
||||
|
@ -124,7 +124,7 @@ async fn main() {
|
||||
if elapsed < 1000 {
|
||||
let delay = 1000 - elapsed;
|
||||
println!("delaying {}ms before loading next page", delay);
|
||||
tokio::time::delay_for(std::time::Duration::from_millis(delay)).await;
|
||||
tokio::time::sleep(std::time::Duration::from_millis(delay)).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,14 @@ struct NeededPost {
|
||||
full_url: String,
|
||||
}
|
||||
|
||||
fn get_hasher() -> img_hash::Hasher<[u8; 8]> {
|
||||
img_hash::HasherConfig::with_bytes_type::<[u8; 8]>()
|
||||
.hash_alg(img_hash::HashAlg::Gradient)
|
||||
.hash_size(8, 8)
|
||||
.preproc_dct()
|
||||
.to_hasher()
|
||||
}
|
||||
|
||||
async fn hash_url(
|
||||
id: i32,
|
||||
client: std::sync::Arc<reqwest::Client>,
|
||||
@ -21,7 +29,7 @@ async fn hash_url(
|
||||
.await
|
||||
.expect("unable to get bytes");
|
||||
|
||||
let hasher = furaffinity_rs::get_hasher();
|
||||
let hasher = get_hasher();
|
||||
let image = match image::load_from_memory(&data) {
|
||||
Ok(image) => image,
|
||||
Err(e) => {
|
||||
@ -100,7 +108,7 @@ async fn main() {
|
||||
|
||||
if needed_posts.is_empty() {
|
||||
println!("no posts, waiting a minute");
|
||||
tokio::time::delay_for(std::time::Duration::from_secs(60)).await;
|
||||
tokio::time::sleep(std::time::Duration::from_secs(60)).await;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ async fn main() {
|
||||
if elapsed < 1000 {
|
||||
let delay = 1000 - elapsed;
|
||||
println!("delaying {}ms before loading next page", delay);
|
||||
tokio::time::delay_for(std::time::Duration::from_millis(delay)).await;
|
||||
tokio::time::sleep(std::time::Duration::from_millis(delay)).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user