no recomp needed

This commit is contained in:
2025-03-31 14:53:10 -06:00
parent 4a433a1a77
commit add6f00ed6
4 changed files with 28 additions and 7 deletions

View File

@@ -59,6 +59,13 @@ fn valid_file_extension(take: &&OsStr) -> bool {
"pdf" => true,
"json" => true,
"xml" => true,
// IGNORE
// TODO Should this be a list of all domains?
"org" => false,
"com" => false,
"net" => false,
_ => {
warn!("Might be forgetting a file extension: {s}");
false

View File

@@ -33,11 +33,14 @@ struct Config {
surreal_password: String,
crawl_filter: String,
start_url: String,
budget: usize,
}
#[tokio::main]
async fn main() {
println!("Logs and metrics are provided to the Grafana dashboard");
let writer = std::fs::OpenOptions::new()
.append(true)
.create(true)
@@ -70,8 +73,7 @@ async fn main() {
.expect("failed to install recorder/exporter");
info!("Starting...");
// Would probably take these in as parameters from a cli
let starting_url = "https://en.wikipedia.org/";
// When getting uncrawled pages, name must contain this variable. "" will effectively get ignored.
// let crawl_filter = "en.wikipedia.org/";
// let budget = 50;
@@ -82,6 +84,7 @@ async fn main() {
let _ = file.read_to_string(&mut buf);
let config: Config = toml::from_str(&buf).expect("Failed to parse Crawler.toml");
let starting_url = &config.start_url;
let db = connect(&config)
.await
@@ -138,6 +141,15 @@ async fn main() {
}
drop(span);
if let Ok(mut ok) = db.query("count(select id from website where crawled = true)").await {
let res = ok.take::<Option<usize>>(0);
if let Ok(i) = res {
if let Some(n) = i {
info!("Total crawled pages now equals {n}");
}
}
}
info!("Done");
}