Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
Update Cargo.toml
  • Loading branch information
ForgQi committed Mar 6, 2024
1 parent d615e07 commit 998cac5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions crates/biliup/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use reqwest_middleware::{ClientBuilder, ClientWithMiddleware};
use reqwest_retry::policies::ExponentialBackoff;
use reqwest_retry::RetryTransientMiddleware;
use std::sync::Arc;
use std::time::Duration;

#[derive(Debug, Clone)]
pub struct StatelessClient {
Expand All @@ -20,9 +21,8 @@ impl StatelessClient {
let client = reqwest::Client::builder()
.user_agent("Mozilla/5.0 (X11; Linux x86_64; rv:60.1) Gecko/20100101 Firefox/60.1")
.default_headers(headers)
// .connect_timeout(std::time::Duration::from_secs(60))
// .timeout(Duration::new(60, 0))
// .connect_timeout()
.connect_timeout(Duration::from_secs(60))
.build()
.unwrap();
let retry_policy = ExponentialBackoff::builder().build_with_max_retries(5);
Expand Down Expand Up @@ -75,6 +75,7 @@ impl StatefulClient {
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/63.0.3239.108",
)
.default_headers(headers)
.connect_timeout(Duration::from_secs(60))
// .timeout(Duration::new(60, 0))
.build()
.unwrap(),
Expand Down
2 changes: 1 addition & 1 deletion crates/biliup/src/downloader/httpflv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ impl Connection {
// BytesMut::with_capacity(0).deref_mut()
// tokio::fs::File::open("").read()
// self.resp.chunk()
if let Ok(Some(chunk)) = timeout(Duration::from_millis(30), self.resp.chunk()).await? {
if let Ok(Some(chunk)) = timeout(Duration::from_secs(30), self.resp.chunk()).await? {
// let n = chunk.len();
// println!("Chunk: {:?}", chunk);
self.buffer.put(chunk);
Expand Down
4 changes: 4 additions & 0 deletions crates/biliup/src/uploader/line/upos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use serde::{Deserialize, Serialize};
use serde_json::json;
use std::ffi::OsStr;
use std::path::Path;
use std::time::Duration;

use crate::client::StatelessClient;
use crate::retry;
Expand Down Expand Up @@ -54,6 +55,7 @@ impl Upos {
.client_with_middleware
.post(format!("{url}?uploads&output=json"))
.header("X-Upos-Auth", header::HeaderValue::from_str(&bucket.auth)?)
.timeout(Duration::from_secs(60))
.send()
.await?
.json()
Expand Down Expand Up @@ -125,6 +127,7 @@ impl Upos {
header::HeaderValue::from_str(&self.bucket.auth)?,
)
.query(&params)
.timeout(Duration::from_secs(240))
.header(CONTENT_LENGTH, len)
.body(chunk.clone())
.send()
Expand Down Expand Up @@ -164,6 +167,7 @@ impl Upos {
)
.query(&value)
.json(&json!({ "parts": parts }))
.timeout(Duration::from_secs(60))
.send()
.await?
.json()
Expand Down
2 changes: 1 addition & 1 deletion crates/stream-gears/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "stream-gears"
version = "0.1.20"
version = "0.1.21"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down

0 comments on commit 998cac5

Please sign in to comment.