feat: archive forge data if it doesn't exist

This commit is contained in:
Aravinth Manivannan 2022-06-03 23:14:57 +05:30
parent 8d222d185b
commit 7e0c235275
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88

View file

@ -41,8 +41,16 @@ impl Ctx {
forge_type: gitea.forge_type(), forge_type: gitea.forge_type(),
}; };
db.create_forge_isntance(&msg).await.unwrap(); db.create_forge_isntance(&msg).await.unwrap();
} else {
if !federate.forge_exists(hostname).await.unwrap() {
let forge = db.get_forge(hostname).await.unwrap();
let msg = CreateForge {
hostname,
forge_type: forge.forge_type,
};
federate.create_forge_isntance(&msg).await.unwrap(); federate.create_forge_isntance(&msg).await.unwrap();
} }
}
loop { loop {
info!("[crawl][{hostname}] Crawling. page: {page}"); info!("[crawl][{hostname}] Crawling. page: {page}");