diff options
| author | Teddy Wing | 2021-06-06 15:59:29 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2021-06-06 15:59:29 +0200 | 
| commit | 60493a4851ac0e306dd53bc08470721424694b63 (patch) | |
| tree | 140b30b2c2133ce120a2c4ff77033448eb767710 | |
| parent | ef924ebb9005d19321bc3336ec9894f0878d9aaf (diff) | |
| download | reflectub-60493a4851ac0e306dd53bc08470721424694b63.tar.bz2 | |
Remove old in-progress threading code
Remove this now that we have something that I think works.
| -rw-r--r-- | src/main.rs | 76 | 
1 files changed, 1 insertions, 75 deletions
| diff --git a/src/main.rs b/src/main.rs index 20587d5..10cb836 100644 --- a/src/main.rs +++ b/src/main.rs @@ -94,7 +94,7 @@ fn run() -> anyhow::Result<()> {          },      ]; -    let mut db = Arc::new( +    let db = Arc::new(          tokio::sync::Mutex::new(              executor::block_on(database::Db::connect(&database_file))?,          ) @@ -104,80 +104,6 @@ fn run() -> anyhow::Result<()> {          db.lock().await.create().await      })?; -    // let pool = executor::ThreadPool::builder() -    //     .pool_size(4) -    //     .create()?; - -    // for repo in test_repos { -    // let join = test_repos.par_iter() -    // let join = tokio::spawn(async move { -    //     let id = repo.id; -    //     let path = clone_path(&mirror_root, &repo); -    //     let db_repo = database::Repo::from(&repo); -    // -    //     match db.repo_get(id).await { -    //         // If we've already seen the repo and it's been updated, fetch the -    //         // latest. -    //         Ok(current_repo) => { -    //             if db.repo_is_updated(&db_repo).await? { -    //                 update(&path, ¤t_repo, &repo)?; -    // -    //                 db.repo_update(&db_repo).await?; -    //             } -    //         }, -    // -    //         // If the repo doesn't exist, mirror it and store it in the -    //         // database. -    //         Err(database::Error::Db(sqlx::Error::RowNotFound)) => { -    //             mirror( -    //                 &path, -    //                 &repo, -    //                 base_cgitrc.as_ref(), -    //             )?; -    // -    //             db.repo_insert(db_repo).await?; -    //         }, -    // -    //         Err(e) => anyhow::bail!(e), -    //     } -    // -    //     Ok(()) -    // }); - -        // let join = tokio::spawn( -        //     process_repo(&repo, &mut db, &mirror_root, base_cgitrc), -        // ); -        // -        // join.await?; -    // } - -    // let tasks = test_repos.iter().map(|repo| -    //     pool.spawn_ok(process_repo(&repo, &mut db, &mirror_root, base_cgitrc)) -    // ); -    // -    // executor::block_on(future::join_all(tasks)); - -    // let tasks = test_repos.iter().map(|repo| -    //     process_repo(&repo, &mut db, &mirror_root, base_cgitrc)); -    // -    // executor::block_on(async { tokio::try_join!(tasks) })?; - -    // let joins = test_repos.into_iter() -    //     .map(|repo| { -    //         let db = db.clone(); -    // -    //         let result = process_repo( -    //             &repo, -    //             &mut db.lock().unwrap(), -    //             &mirror_root.clone(), -    //             base_cgitrc.clone(), -    //         ); -    // -    //         result -    //     }) -    //     .map(tokio::spawn); -        // .collect::<Vec<_>>(); -      let mut joins = Vec::new();      for repo in test_repos { | 
