aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.rs76
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, &current_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 {