aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorTeddy Wing2021-06-12 18:25:49 +0200
committerTeddy Wing2021-06-12 18:25:49 +0200
commit46497bbae37f89e449b7a049663fe774843beb9b (patch)
tree89403988f141f61e0e2a78d655730e7cbc19dad8 /src/main.rs
parent6a6bacf975156a045cf48f9e58520f0bc0f54429 (diff)
downloadreflectub-46497bbae37f89e449b7a049663fe774843beb9b.tar.bz2
Switch from 'reqwest' to 'ureq'; Remove async
Remove all async from the project by switching from 'reqwest' to 'ureq'. This should make the code simpler, and hopefully enable us to try out multithreading.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs19
1 files changed, 3 insertions, 16 deletions
diff --git a/src/main.rs b/src/main.rs
index 4b36264..4e4d580 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -24,8 +24,6 @@ use filetime;
use getopts::Options;
use parse_size::parse_size;
use rusqlite;
-use tokio;
-use tokio_stream::StreamExt;
use reflectub::{database, git, github};
@@ -38,18 +36,7 @@ use std::sync::{Arc, Mutex};
fn main() {
- let rt = tokio::runtime::Builder::new_multi_thread()
- .enable_io()
- .enable_time()
- .worker_threads(4)
- .build()
- .unwrap();
- // let rt = tokio::runtime::Runtime::new()
- let _rt_guard = rt.enter();
-
- let result = rt.block_on(run());
-
- match result {
+ match run() {
Ok(_) => (),
Err(e) => {
eprint!("error");
@@ -72,7 +59,7 @@ fn print_usage(opts: &Options) {
);
}
-async fn run() -> anyhow::Result<()> {
+fn run() -> anyhow::Result<()> {
let args: Vec<String> = env::args().collect();
let mut opts = Options::new();
@@ -123,7 +110,7 @@ async fn run() -> anyhow::Result<()> {
let base_cgitrc = opt_matches.opt_str("cgitrc")
.map(|s| PathBuf::from(s));
- let repos = github::fetch_repos(username).await?;
+ let repos = github::fetch_repos(username)?;
let mut db = database::Db::connect(&database_file)
.context("unable to connect to database")?;