@@ -30,13 +30,14 @@ async fn qb_get(client: &Client, url: String) -> Option<Value> {
3030/// # Arguments
3131///
3232/// * `array` - Array of existing torrents in QBitAPI.
33- /// * `pending` - Shared map of pending torrent metadata keyed by tags
34- /// * `state` - Shared state where active torrent tracking entries are stored
33+ /// * `pending` - Shared map of pending torrent metadata keyed by tags.
34+ /// * `state` - Shared state where active torrent tracking entries are stored.
35+ /// * `db_connection` - Database connection received through app data.
3536async fn resolve_new_torrents (
3637 array : & Vec < Value > ,
3738 pending : & settings:: PendingMap ,
3839 state : & settings:: SharedState ,
39- db_conn : & settings:: DbConn ,
40+ db_connection : & settings:: DBConnection ,
4041) {
4142 let mut pending_lock = pending. write ( ) . await ;
4243 let mut db = state. write ( ) . await ;
@@ -67,7 +68,7 @@ async fn resolve_new_torrents(
6768 put_item : item,
6869 } ,
6970 ) ;
70- if let Ok ( conn) = db_conn . lock ( ) {
71+ if let Ok ( conn) = db_connection . lock ( ) {
7172 database:: remove_pending ( & conn, tag) ;
7273 database:: upsert ( & conn, & hash, db. get ( & hash) . unwrap ( ) ) ;
7374 }
@@ -113,10 +114,11 @@ fn notifier(title: String, body: String, config: settings::Config) {
113114///
114115/// # Arguments
115116///
116- /// * `client` - Authenticated HTTP client for qBittorrent API requests
117- /// * `state` - Shared state used to track torrent and transfer progress
118- /// * `pending` - Shared map of pending torrent metadata
119- /// * `config` - Application configuration containing API settings
117+ /// * `client` - Authenticated HTTP client for qBittorrent API requests.
118+ /// * `state` - Shared state used to track torrent and transfer progress.
119+ /// * `pending` - Shared map of pending torrent metadata.
120+ /// * `config` - Application configuration containing API settings.
121+ /// * `db_connection` - Database connection received through app data.
120122///
121123/// # Notes
122124///
@@ -129,7 +131,7 @@ pub fn spawn_worker(
129131 state : settings:: SharedState ,
130132 pending : settings:: PendingMap ,
131133 config : settings:: Config ,
132- db_conn : settings:: DbConn ,
134+ db_connection : settings:: DBConnection ,
133135) {
134136 tokio:: spawn ( async move {
135137 log:: info!( "Worker started" ) ;
@@ -159,7 +161,7 @@ pub fn spawn_worker(
159161 } ;
160162
161163 log:: trace!( "Torrents active: {:?}" , array) ;
162- resolve_new_torrents ( array, & pending, & state, & db_conn ) . await ;
164+ resolve_new_torrents ( array, & pending, & state, & db_connection ) . await ;
163165 } else {
164166 log:: error!( "Failed to get info from QBitAPI" ) ;
165167
@@ -210,7 +212,7 @@ pub fn spawn_worker(
210212 if !returned. contains ( h. as_str ( ) ) {
211213 log:: info!( "Torrent removed from QBitAPI, dropping from state: {}" , h) ;
212214 db. remove ( h) ;
213- if let Ok ( conn) = db_conn . lock ( ) {
215+ if let Ok ( conn) = db_connection . lock ( ) {
214216 database:: remove ( & conn, h) ;
215217 }
216218 }
@@ -241,7 +243,7 @@ pub fn spawn_worker(
241243 config_cloned,
242244 ) ;
243245 db. remove ( & hash) ;
244- if let Ok ( conn) = db_conn . lock ( ) {
246+ if let Ok ( conn) = db_connection . lock ( ) {
245247 database:: remove ( & conn, & hash) ;
246248 }
247249 }
@@ -279,7 +281,7 @@ pub fn spawn_worker(
279281 }
280282 }
281283 db. remove ( & hash) ;
282- if let Ok ( conn) = db_conn . lock ( ) {
284+ if let Ok ( conn) = db_connection . lock ( ) {
283285 database:: remove ( & conn, & hash) ;
284286 }
285287 }
@@ -342,7 +344,11 @@ pub fn get_env_var(key: &str, default: Option<&str>) -> String {
342344 default. unwrap_or_default ( ) . to_string ( )
343345}
344346
345- /// Load dotenv file using the env var `env_file` or `ENV_FILE`
347+ /// Load dotenv file using the `env_file` CLI arg or an environment variable.
348+ ///
349+ /// # Arguments
350+ ///
351+ /// * `env_file` - Takes the `env_file` passed through CLI argument.
346352pub fn load_env_file ( mut env_file : String ) {
347353 if env_file. is_empty ( ) {
348354 env_file = get_env_var ( "env_file" , Some ( ".env" ) ) ;
@@ -356,11 +362,11 @@ pub fn load_env_file(mut env_file: String) {
356362/// # Description
357363/// A secret is considered strong if it satisfies all the following:
358364///
359- /// - Has at least ` min_length` characters
360- /// - Contains at least 1 digit
361- /// - Contains at least 1 symbol (non-alphanumeric, non-whitespace)
362- /// - Contains at least 1 uppercase letter
363- /// - Contains at least 1 lowercase letter
365+ /// - Has at least " min_length" characters
366+ /// - Contains at least 1 digit
367+ /// - Contains at least 1 symbol (non-alphanumeric, non-whitespace)
368+ /// - Contains at least 1 uppercase letter
369+ /// - Contains at least 1 lowercase letter
364370///
365371/// # Arguments
366372///
0 commit comments