Try to increase limits on start
This commit is contained in:
parent
a60738ff89
commit
fc28e18ffd
5 changed files with 26 additions and 1 deletions
10
Cargo.lock
generated
10
Cargo.lock
generated
|
|
@ -1282,6 +1282,7 @@ dependencies = [
|
||||||
"rand",
|
"rand",
|
||||||
"regex",
|
"regex",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
|
"rlimit",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_urlencoded",
|
"serde_urlencoded",
|
||||||
|
|
@ -2013,6 +2014,15 @@ dependencies = [
|
||||||
"windows-sys 0.48.0",
|
"windows-sys 0.48.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rlimit"
|
||||||
|
version = "0.10.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3560f70f30a0f16d11d01ed078a07740fe6b489667abc7c7b029155d9f21c3d8"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rqbit"
|
name = "rqbit"
|
||||||
version = "5.3.0"
|
version = "5.3.0"
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ base64 = "0.21.5"
|
||||||
serde_with = "3.4.0"
|
serde_with = "3.4.0"
|
||||||
tokio-util = "0.7.10"
|
tokio-util = "0.7.10"
|
||||||
bytes = "1.5.0"
|
bytes = "1.5.0"
|
||||||
|
rlimit = "0.10.1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
futures = {version = "0.3"}
|
futures = {version = "0.3"}
|
||||||
|
|
|
||||||
|
|
@ -59,3 +59,7 @@ pub use librqbit_core::torrent_metainfo::*;
|
||||||
pub fn version() -> &'static str {
|
pub fn version() -> &'static str {
|
||||||
env!("CARGO_PKG_VERSION")
|
env!("CARGO_PKG_VERSION")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn try_increase_nofile_limit() -> anyhow::Result<u64> {
|
||||||
|
Ok(rlimit::increase_nofile_limit(1024 * 1024)?)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -246,6 +246,11 @@ async fn async_main(opts: Opts) -> anyhow::Result<()> {
|
||||||
log_file_rust_log: Some(&opts.log_file_rust_log),
|
log_file_rust_log: Some(&opts.log_file_rust_log),
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
match librqbit::try_increase_nofile_limit() {
|
||||||
|
Ok(limit) => info!(limit = limit, "inreased open file limit"),
|
||||||
|
Err(e) => warn!("failed increasing open file limit: {:#}", e),
|
||||||
|
};
|
||||||
|
|
||||||
let mut sopts = SessionOptions {
|
let mut sopts = SessionOptions {
|
||||||
disable_dht: opts.disable_dht,
|
disable_dht: opts.disable_dht,
|
||||||
disable_dht_persistence: opts.disable_dht_persistence,
|
disable_dht_persistence: opts.disable_dht_persistence,
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ use librqbit::{
|
||||||
};
|
};
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use tracing::{error, error_span};
|
use tracing::{error, error_span, info, warn};
|
||||||
|
|
||||||
const ERR_NOT_CONFIGURED: ApiError =
|
const ERR_NOT_CONFIGURED: ApiError =
|
||||||
ApiError::new_from_text(StatusCode::FAILED_DEPENDENCY, "not configured");
|
ApiError::new_from_text(StatusCode::FAILED_DEPENDENCY, "not configured");
|
||||||
|
|
@ -307,6 +307,11 @@ async fn start() {
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
match librqbit::try_increase_nofile_limit() {
|
||||||
|
Ok(limit) => info!(limit = limit, "inreased open file limit"),
|
||||||
|
Err(e) => warn!("failed increasing open file limit: {:#}", e),
|
||||||
|
};
|
||||||
|
|
||||||
let state = State::new(init_logging_result).await;
|
let state = State::new(init_logging_result).await;
|
||||||
|
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue